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

Unified Diff: base/test/launcher/test_launcher.cc

Issue 1100773004: base: Remove most uses of MessageLoopProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added some missing includes. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/task_runner_util_unittest.cc ('k') | base/test/launcher/unit_test_launcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/launcher/test_launcher.cc
diff --git a/base/test/launcher/test_launcher.cc b/base/test/launcher/test_launcher.cc
index 521f69c1ed5f4466eecb2ac77505021a25a2315c..7f258f5f3953f7b20b3379f87fb009bbc6e78de2 100644
--- a/base/test/launcher/test_launcher.cc
+++ b/base/test/launcher/test_launcher.cc
@@ -18,11 +18,13 @@
#include "base/format_macros.h"
#include "base/hash.h"
#include "base/lazy_instance.h"
+#include "base/location.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/process/kill.h"
#include "base/process/launch.h"
+#include "base/single_thread_task_runner.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
@@ -34,6 +36,7 @@
#include "base/test/sequenced_worker_pool_owner.h"
#include "base/test/test_switches.h"
#include "base/test/test_timeouts.h"
+#include "base/thread_task_runner_handle.h"
#include "base/threading/thread_checker.h"
#include "base/time/time.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -349,7 +352,7 @@ void DoLaunchChildTestProcess(
TimeDelta timeout,
int flags,
bool redirect_stdio,
- scoped_refptr<MessageLoopProxy> message_loop_proxy,
+ SingleThreadTaskRunner* task_runner,
const TestLauncher::LaunchChildGTestProcessCallback& callback) {
TimeTicks start_time = TimeTicks::Now();
@@ -423,14 +426,9 @@ void DoLaunchChildTestProcess(
// Run target callback on the thread it was originating from, not on
// a worker pool thread.
- message_loop_proxy->PostTask(
- FROM_HERE,
- Bind(&RunCallback,
- callback,
- exit_code,
- TimeTicks::Now() - start_time,
- was_timeout,
- output_file_contents));
+ task_runner->PostTask(FROM_HERE, Bind(&RunCallback, callback, exit_code,
+ TimeTicks::Now() - start_time,
+ was_timeout, output_file_contents));
}
} // namespace
@@ -504,9 +502,8 @@ bool TestLauncher::Run() {
// Start the watchdog timer.
watchdog_timer_.Reset();
- MessageLoop::current()->PostTask(
- FROM_HERE,
- Bind(&TestLauncher::RunTestIteration, Unretained(this)));
+ ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, Bind(&TestLauncher::RunTestIteration, Unretained(this)));
MessageLoop::current()->Run();
@@ -536,16 +533,10 @@ void TestLauncher::LaunchChildGTestProcess(
bool redirect_stdio = (parallel_jobs_ > 1) || BotModeEnabled();
worker_pool_owner_->pool()->PostWorkerTask(
- FROM_HERE,
- Bind(&DoLaunchChildTestProcess,
- new_command_line,
- timeout,
- flags,
- redirect_stdio,
- MessageLoopProxy::current(),
- Bind(&TestLauncher::OnLaunchTestProcessFinished,
- Unretained(this),
- callback)));
+ FROM_HERE, Bind(&DoLaunchChildTestProcess, new_command_line, timeout,
+ flags, redirect_stdio, ThreadTaskRunnerHandle::Get(),
+ Bind(&TestLauncher::OnLaunchTestProcessFinished,
+ Unretained(this), callback)));
}
void TestLauncher::OnTestFinished(const TestResult& result) {
@@ -957,9 +948,8 @@ void TestLauncher::RunTests() {
fflush(stdout);
// No tests have actually been started, so kick off the next iteration.
- MessageLoop::current()->PostTask(
- FROM_HERE,
- Bind(&TestLauncher::RunTestIteration, Unretained(this)));
+ ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, Bind(&TestLauncher::RunTestIteration, Unretained(this)));
}
}
@@ -980,7 +970,7 @@ void TestLauncher::RunTestIteration() {
tests_to_retry_.clear();
results_tracker_.OnTestIterationStarting();
- MessageLoop::current()->PostTask(
+ ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, Bind(&TestLauncher::RunTests, Unretained(this)));
}
@@ -1027,9 +1017,8 @@ void TestLauncher::OnTestIterationFinished() {
results_tracker_.PrintSummaryOfCurrentIteration();
// Kick off the next iteration.
- MessageLoop::current()->PostTask(
- FROM_HERE,
- Bind(&TestLauncher::RunTestIteration, Unretained(this)));
+ ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, Bind(&TestLauncher::RunTestIteration, Unretained(this)));
}
void TestLauncher::OnOutputTimeout() {
« no previous file with comments | « base/task_runner_util_unittest.cc ('k') | base/test/launcher/unit_test_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698