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

Unified Diff: base/threading/thread_unittest.cc

Issue 1100773004: base: Remove most uses of MessageLoopProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
Index: base/threading/thread_unittest.cc
diff --git a/base/threading/thread_unittest.cc b/base/threading/thread_unittest.cc
index f4d024f1a26a79fb53ac599ff5ba3c8202727da8..a89768e9d0a2690e97f6f1dc786ed097450d69d2 100644
--- a/base/threading/thread_unittest.cc
+++ b/base/threading/thread_unittest.cc
@@ -7,7 +7,8 @@
#include <vector>
#include "base/bind.h"
-#include "base/message_loop/message_loop.h"
+#include "base/location.h"
+#include "base/single_thread_task_runner.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
@@ -144,7 +145,7 @@ TEST_F(ThreadTest, StartWithOptions_StackSize) {
EXPECT_TRUE(a.IsRunning());
bool was_invoked = false;
- a.message_loop()->PostTask(FROM_HERE, base::Bind(&ToggleValue, &was_invoked));
+ a.task_runner()->PostTask(FROM_HERE, base::Bind(&ToggleValue, &was_invoked));
// wait for the task to run (we could use a kernel event here
// instead to avoid busy waiting, but this is sufficient for
@@ -165,14 +166,12 @@ TEST_F(ThreadTest, TwoTasks) {
// Test that all events are dispatched before the Thread object is
// destroyed. We do this by dispatching a sleep event before the
// event that will toggle our sentinel value.
- a.message_loop()->PostTask(
- FROM_HERE,
- base::Bind(
- static_cast<void (*)(base::TimeDelta)>(
- &base::PlatformThread::Sleep),
- base::TimeDelta::FromMilliseconds(20)));
- a.message_loop()->PostTask(FROM_HERE, base::Bind(&ToggleValue,
- &was_invoked));
+ a.task_runner()->PostTask(
+ FROM_HERE, base::Bind(static_cast<void (*)(base::TimeDelta)>(
+ &base::PlatformThread::Sleep),
+ base::TimeDelta::FromMilliseconds(20)));
+ a.task_runner()->PostTask(FROM_HERE,
+ base::Bind(&ToggleValue, &was_invoked));
}
EXPECT_TRUE(was_invoked);
}
@@ -221,7 +220,7 @@ TEST_F(ThreadTest, CleanUp) {
// Register an observer that writes into |captured_events| once the
// thread's message loop is destroyed.
- t.message_loop()->PostTask(
+ t.task_runner()->PostTask(
FROM_HERE, base::Bind(&RegisterDestructionObserver,
base::Unretained(&loop_destruction_observer)));

Powered by Google App Engine
This is Rietveld 408576698