OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/test/launcher/test_launcher.h" | 5 #include "base/test/launcher/test_launcher.h" |
6 | 6 |
7 #if defined(OS_POSIX) | 7 #if defined(OS_POSIX) |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 } else if (print_test_stdio == "always") { | 563 } else if (print_test_stdio == "always") { |
564 print_snippet = true; | 564 print_snippet = true; |
565 } else if (print_test_stdio == "never") { | 565 } else if (print_test_stdio == "never") { |
566 print_snippet = false; | 566 print_snippet = false; |
567 } else { | 567 } else { |
568 LOG(WARNING) << "Invalid value of " << switches::kTestLauncherPrintTestStdio | 568 LOG(WARNING) << "Invalid value of " << switches::kTestLauncherPrintTestStdio |
569 << ": " << print_test_stdio; | 569 << ": " << print_test_stdio; |
570 } | 570 } |
571 if (print_snippet) { | 571 if (print_snippet) { |
572 std::vector<std::string> snippet_lines; | 572 std::vector<std::string> snippet_lines; |
573 SplitString(result.output_snippet, '\n', &snippet_lines); | 573 SplitStringDontTrim(result.output_snippet, '\n', &snippet_lines); |
574 if (snippet_lines.size() > kOutputSnippetLinesLimit) { | 574 if (snippet_lines.size() > kOutputSnippetLinesLimit) { |
575 size_t truncated_size = snippet_lines.size() - kOutputSnippetLinesLimit; | 575 size_t truncated_size = snippet_lines.size() - kOutputSnippetLinesLimit; |
576 snippet_lines.erase( | 576 snippet_lines.erase( |
577 snippet_lines.begin(), | 577 snippet_lines.begin(), |
578 snippet_lines.begin() + truncated_size); | 578 snippet_lines.begin() + truncated_size); |
579 snippet_lines.insert(snippet_lines.begin(), "<truncated>"); | 579 snippet_lines.insert(snippet_lines.begin(), "<truncated>"); |
580 } | 580 } |
581 fprintf(stdout, "%s", JoinString(snippet_lines, "\n").c_str()); | 581 fprintf(stdout, "%s", JoinString(snippet_lines, "\n").c_str()); |
582 fflush(stdout); | 582 fflush(stdout); |
583 } | 583 } |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 } | 1081 } |
1082 | 1082 |
1083 std::string snippet(full_output.substr(run_pos)); | 1083 std::string snippet(full_output.substr(run_pos)); |
1084 if (end_pos != std::string::npos) | 1084 if (end_pos != std::string::npos) |
1085 snippet = full_output.substr(run_pos, end_pos - run_pos); | 1085 snippet = full_output.substr(run_pos, end_pos - run_pos); |
1086 | 1086 |
1087 return snippet; | 1087 return snippet; |
1088 } | 1088 } |
1089 | 1089 |
1090 } // namespace base | 1090 } // namespace base |
OLD | NEW |