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

Unified Diff: gin/modules/timer_unittest.cc

Issue 1129873002: Reland of Adding task runner/ message loop to tests that use IsolateHolder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved using derivatives inside namespace. 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
« no previous file with comments | « gin/modules/module_registry_unittest.cc ('k') | gin/shell_runner_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gin/modules/timer_unittest.cc
diff --git a/gin/modules/timer_unittest.cc b/gin/modules/timer_unittest.cc
index 705bdc5697864c1072740cb86a4186e34533e2d9..612275e4729becc079cc71fa2ca27b84020e8c02 100644
--- a/gin/modules/timer_unittest.cc
+++ b/gin/modules/timer_unittest.cc
@@ -64,9 +64,10 @@ struct TestHelper {
result->GetWrapper(isolate));
}
- void QuitSoon() {
- loop.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(),
- base::TimeDelta::FromMilliseconds(0));
+ void QuitSoon(base::MessageLoop* message_loop) {
+ message_loop->PostDelayedTask(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
@@ -91,8 +91,8 @@ TEST_F(TimerUnittest, OneShot) {
helper.runner->Run(source, "script");
EXPECT_EQ(0, helper.result->count());
- helper.QuitSoon();
- helper.loop.Run();
+ helper.QuitSoon(&message_loop_);
+ message_loop_.Run();
EXPECT_EQ(1, helper.result->count());
}
@@ -107,8 +107,8 @@ TEST_F(TimerUnittest, OneShotCancel) {
helper.runner->Run(source, "script");
EXPECT_EQ(0, helper.result->count());
- helper.QuitSoon();
- helper.loop.Run();
+ helper.QuitSoon(&message_loop_);
+ message_loop_.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();
+ message_loop_.Run();
EXPECT_EQ(3, helper.result->count());
}
@@ -143,9 +143,9 @@ TEST_F(TimerUnittest, TimerCallbackToDestroyedRunner) {
EXPECT_EQ(0, helper.result->count());
// Destroy runner, which should destroy the timer object we created.
- helper.QuitSoon();
+ helper.QuitSoon(&message_loop_);
helper.runner.reset(NULL);
- helper.loop.Run();
+ message_loop_.Run();
// Timer should not have run because it was deleted.
EXPECT_EQ(0, helper.result->count());
« no previous file with comments | « gin/modules/module_registry_unittest.cc ('k') | gin/shell_runner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698