1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33

ash / system / diagnostics / log_test_helpers.cc [blame]

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/system/diagnostics/log_test_helpers.h"

#include <string>
#include <vector>

#include "base/strings/string_split.h"

namespace ash {
namespace diagnostics {

const char kSeparator[] = "-";
const char kNewline[] = "\n";

std::vector<std::string> GetLogLines(const std::string& log) {
  return base::SplitString(log, kNewline,
                           base::WhitespaceHandling::TRIM_WHITESPACE,
                           base::SplitResult::SPLIT_WANT_NONEMPTY);
}

std::vector<std::string> GetLogLineContents(const std::string& log_line,
                                            const std::string& separators) {
  const std::vector<std::string> result = base::SplitString(
      log_line, separators, base::WhitespaceHandling::TRIM_WHITESPACE,
      base::SplitResult::SPLIT_WANT_NONEMPTY);
  return result;
}

}  // namespace diagnostics
}  // namespace ash