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

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

Issue 1815363002: Add RetainedRef uses where needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
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 #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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 // Record the exact command line used to launch the child. 530 // Record the exact command line used to launch the child.
531 CommandLine new_command_line( 531 CommandLine new_command_line(
532 PrepareCommandLineForGTest(command_line, wrapper)); 532 PrepareCommandLineForGTest(command_line, wrapper));
533 533
534 // When running in parallel mode we need to redirect stdio to avoid mixed-up 534 // When running in parallel mode we need to redirect stdio to avoid mixed-up
535 // output. We also always redirect on the bots to get the test output into 535 // output. We also always redirect on the bots to get the test output into
536 // JSON summary. 536 // JSON summary.
537 bool redirect_stdio = (parallel_jobs_ > 1) || BotModeEnabled(); 537 bool redirect_stdio = (parallel_jobs_ > 1) || BotModeEnabled();
538 538
539 worker_pool_owner_->pool()->PostWorkerTask( 539 worker_pool_owner_->pool()->PostWorkerTask(
540 FROM_HERE, Bind(&DoLaunchChildTestProcess, new_command_line, timeout, 540 FROM_HERE,
541 flags, redirect_stdio, ThreadTaskRunnerHandle::Get(), 541 Bind(&DoLaunchChildTestProcess, new_command_line, timeout, flags,
542 Bind(&TestLauncher::OnLaunchTestProcessFinished, 542 redirect_stdio, RetainedRef(ThreadTaskRunnerHandle::Get()),
543 Unretained(this), callback))); 543 Bind(&TestLauncher::OnLaunchTestProcessFinished, Unretained(this),
544 callback)));
544 } 545 }
545 546
546 void TestLauncher::OnTestFinished(const TestResult& result) { 547 void TestLauncher::OnTestFinished(const TestResult& result) {
547 ++test_finished_count_; 548 ++test_finished_count_;
548 549
549 bool print_snippet = false; 550 bool print_snippet = false;
550 std::string print_test_stdio("auto"); 551 std::string print_test_stdio("auto");
551 if (CommandLine::ForCurrentProcess()->HasSwitch( 552 if (CommandLine::ForCurrentProcess()->HasSwitch(
552 switches::kTestLauncherPrintTestStdio)) { 553 switches::kTestLauncherPrintTestStdio)) {
553 print_test_stdio = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 554 print_test_stdio = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 } 1093 }
1093 1094
1094 std::string snippet(full_output.substr(run_pos)); 1095 std::string snippet(full_output.substr(run_pos));
1095 if (end_pos != std::string::npos) 1096 if (end_pos != std::string::npos)
1096 snippet = full_output.substr(run_pos, end_pos - run_pos); 1097 snippet = full_output.substr(run_pos, end_pos - run_pos);
1097 1098
1098 return snippet; 1099 return snippet;
1099 } 1100 }
1100 1101
1101 } // namespace base 1102 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698