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

Unified Diff: content/public/test/test_utils.cc

Issue 2548883002: Revert of Add thread checking to RunLoop, deprecate MessageLoopRunner. (Closed)
Patch Set: Created 4 years 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 | « content/public/test/test_utils.h ('k') | extensions/test/result_catcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/test_utils.cc
diff --git a/content/public/test/test_utils.cc b/content/public/test/test_utils.cc
index 4c6449df4a768ca0e90008041d931fabc39c98c3..a19a31d5aa36c9d1214c5c91a34c06ce96863b0b 100644
--- a/content/public/test/test_utils.cc
+++ b/content/public/test/test_utils.cc
@@ -120,14 +120,23 @@
void RunThisRunLoop(base::RunLoop* run_loop) {
base::MessageLoop::ScopedNestableTaskAllower allow(
base::MessageLoop::current());
+
+ // If we're running inside a browser test, we might need to allow the test
+ // launcher to do extra work before/after running a nested message loop.
+ TestLauncherDelegate* delegate = NULL;
+ delegate = GetCurrentTestLauncherDelegate();
+ if (delegate)
+ delegate->PreRunMessageLoop(run_loop);
run_loop->Run();
+ if (delegate)
+ delegate->PostRunMessageLoop();
}
void RunAllPendingInMessageLoop() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
base::RunLoop run_loop;
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, GetDeferredQuitTaskForRunLoop(&run_loop));
+ FROM_HERE, GetQuitTaskForRunLoop(&run_loop));
RunThisRunLoop(&run_loop);
}
@@ -166,7 +175,7 @@
}
}
-base::Closure GetDeferredQuitTaskForRunLoop(base::RunLoop* run_loop) {
+base::Closure GetQuitTaskForRunLoop(base::RunLoop* run_loop) {
return base::Bind(&DeferredQuitRunLoop, run_loop->QuitClosure(),
kNumQuitDeferrals);
}
@@ -231,7 +240,7 @@
if (loop_running_) {
switch (quit_mode_) {
case QuitMode::DEFERRED:
- GetDeferredQuitTaskForRunLoop(&run_loop_).Run();
+ GetQuitTaskForRunLoop(&run_loop_).Run();
break;
case QuitMode::IMMEDIATE:
run_loop_.Quit();
« no previous file with comments | « content/public/test/test_utils.h ('k') | extensions/test/result_catcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698