Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: base/test/launcher/test_launcher.cc

Issue 1081493002: base/test/launcher: don't trim leading whitespace from test output (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lucasfix
Patch Set: Remove UTF8 DCHECK from SplitStringDontTrim Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« base/strings/string_split.cc ('K') | « base/strings/string_split.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« base/strings/string_split.cc ('K') | « base/strings/string_split.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698