log_test_helpers.cc 968 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "ash/system/diagnostics/log_test_helpers.h"
  5. #include <string>
  6. #include <vector>
  7. #include "base/strings/string_split.h"
  8. namespace ash {
  9. namespace diagnostics {
  10. const char kSeparator[] = "-";
  11. const char kNewline[] = "\n";
  12. std::vector<std::string> GetLogLines(const std::string& log) {
  13. return base::SplitString(log, kNewline,
  14. base::WhitespaceHandling::TRIM_WHITESPACE,
  15. base::SplitResult::SPLIT_WANT_NONEMPTY);
  16. }
  17. std::vector<std::string> GetLogLineContents(const std::string& log_line) {
  18. const std::vector<std::string> result = base::SplitString(
  19. log_line, kSeparator, base::WhitespaceHandling::TRIM_WHITESPACE,
  20. base::SplitResult::SPLIT_WANT_NONEMPTY);
  21. return result;
  22. }
  23. } // namespace diagnostics
  24. } // namespace ash