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

Unified Diff: gin/modules/timer_unittest.cc

Issue 1130433002: Adding task runner/ message loop to tests that use IsolateHolder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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: gin/modules/timer_unittest.cc
diff --git a/gin/modules/timer_unittest.cc b/gin/modules/timer_unittest.cc
index 705bdc5697864c1072740cb86a4186e34533e2d9..c8b9ce0fe91d888a906efef3c7439b86ac63aaa9 100644
--- a/gin/modules/timer_unittest.cc
+++ b/gin/modules/timer_unittest.cc
@@ -65,8 +65,9 @@ struct TestHelper {
}
void QuitSoon() {
- loop.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(),
- base::TimeDelta::FromMilliseconds(0));
+ base::MessageLoop::current()->PostDelayedTask(
Sami 2015/05/05 13:55:54 Please use ThreadTaskRunnerHandle::Get() instead o
Primiano Tucci (use gerrit) 2015/05/05 14:26:51 Is this going to use the DummyTaskRunner? If so, i
Sami 2015/05/05 14:35:46 Actually not, because you can't have both a Messag
ssid 2015/05/05 16:00:06 No, this change here is not related to the dummy t
+ FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(),
+ base::TimeDelta::FromMilliseconds(0));
}
ShellRunnerDelegate delegate;
@@ -74,7 +75,6 @@ struct TestHelper {
Runner::Scope scope;
Handle<TimerModule> timer_module;
Handle<Result> result;
- base::MessageLoop loop;
};
} // namespace
@@ -92,7 +92,7 @@ TEST_F(TimerUnittest, OneShot) {
EXPECT_EQ(0, helper.result->count());
helper.QuitSoon();
- helper.loop.Run();
+ base::MessageLoop::current()->Run();
EXPECT_EQ(1, helper.result->count());
}
@@ -108,7 +108,7 @@ TEST_F(TimerUnittest, OneShotCancel) {
EXPECT_EQ(0, helper.result->count());
helper.QuitSoon();
- helper.loop.Run();
+ base::MessageLoop::current()->Run();
EXPECT_EQ(0, helper.result->count());
}
@@ -128,7 +128,7 @@ TEST_F(TimerUnittest, Repeating) {
helper.runner->Run(source, "script");
EXPECT_EQ(0, helper.result->count());
- helper.loop.Run();
+ base::MessageLoop::current()->Run();
EXPECT_EQ(3, helper.result->count());
}
@@ -145,7 +145,7 @@ TEST_F(TimerUnittest, TimerCallbackToDestroyedRunner) {
// Destroy runner, which should destroy the timer object we created.
helper.QuitSoon();
helper.runner.reset(NULL);
- helper.loop.Run();
+ base::MessageLoop::current()->Run();
// Timer should not have run because it was deleted.
EXPECT_EQ(0, helper.result->count());

Powered by Google App Engine
This is Rietveld 408576698