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 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/environment.h" | 10 #include "base/environment.h" |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 // Record the exact command line used to launch the child. | 556 // Record the exact command line used to launch the child. |
557 CommandLine new_command_line( | 557 CommandLine new_command_line( |
558 PrepareCommandLineForGTest(command_line, wrapper)); | 558 PrepareCommandLineForGTest(command_line, wrapper)); |
559 | 559 |
560 // When running in parallel mode we need to redirect stdio to avoid mixed-up | 560 // When running in parallel mode we need to redirect stdio to avoid mixed-up |
561 // output. We also always redirect on the bots to get the test output into | 561 // output. We also always redirect on the bots to get the test output into |
562 // JSON summary. | 562 // JSON summary. |
563 bool redirect_stdio = (parallel_jobs_ > 1) || BotModeEnabled(); | 563 bool redirect_stdio = (parallel_jobs_ > 1) || BotModeEnabled(); |
564 | 564 |
565 worker_pool_owner_->pool()->PostWorkerTask( | 565 worker_pool_owner_->pool()->PostWorkerTask( |
566 FROM_HERE, Bind(&DoLaunchChildTestProcess, new_command_line, timeout, | 566 FROM_HERE, |
567 options, redirect_stdio, ThreadTaskRunnerHandle::Get(), | 567 Bind(&DoLaunchChildTestProcess, new_command_line, timeout, options, |
568 Bind(&TestLauncher::OnLaunchTestProcessFinished, | 568 redirect_stdio, RetainedRef(ThreadTaskRunnerHandle::Get()), |
569 Unretained(this), completed_callback), | 569 Bind(&TestLauncher::OnLaunchTestProcessFinished, Unretained(this), |
570 launched_callback)); | 570 completed_callback), |
| 571 launched_callback)); |
571 } | 572 } |
572 | 573 |
573 void TestLauncher::OnTestFinished(const TestResult& result) { | 574 void TestLauncher::OnTestFinished(const TestResult& result) { |
574 ++test_finished_count_; | 575 ++test_finished_count_; |
575 | 576 |
576 bool print_snippet = false; | 577 bool print_snippet = false; |
577 std::string print_test_stdio("auto"); | 578 std::string print_test_stdio("auto"); |
578 if (CommandLine::ForCurrentProcess()->HasSwitch( | 579 if (CommandLine::ForCurrentProcess()->HasSwitch( |
579 switches::kTestLauncherPrintTestStdio)) { | 580 switches::kTestLauncherPrintTestStdio)) { |
580 print_test_stdio = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 581 print_test_stdio = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 } | 1120 } |
1120 | 1121 |
1121 std::string snippet(full_output.substr(run_pos)); | 1122 std::string snippet(full_output.substr(run_pos)); |
1122 if (end_pos != std::string::npos) | 1123 if (end_pos != std::string::npos) |
1123 snippet = full_output.substr(run_pos, end_pos - run_pos); | 1124 snippet = full_output.substr(run_pos, end_pos - run_pos); |
1124 | 1125 |
1125 return snippet; | 1126 return snippet; |
1126 } | 1127 } |
1127 | 1128 |
1128 } // namespace base | 1129 } // namespace base |
OLD | NEW |