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

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

Issue 17084007: Revert "GTTF: Remove message loop hooks from TestLauncherDelegate" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | « content/public/test/test_utils.h ('k') | no next file » | 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 eca44fbd57ebe339bbca557fdfa795fa3a552ae4..e25425c974600deb7c31420f77f16e509a82663e 100644
--- a/content/public/test/test_utils.cc
+++ b/content/public/test/test_utils.cc
@@ -5,7 +5,6 @@
#include "content/public/test/test_utils.h"
#include "base/bind.h"
-#include "base/lazy_instance.h"
#include "base/message_loop.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
@@ -19,12 +18,6 @@ namespace content {
namespace {
-base::LazyInstance<std::vector<RunMessageLoopHook> >::Leaky
- g_pre_run_message_loop_hooks = LAZY_INSTANCE_INITIALIZER;
-
-base::LazyInstance<std::vector<RunMessageLoopHook> >::Leaky
- g_post_run_message_loop_hooks = LAZY_INSTANCE_INITIALIZER;
-
// Number of times to repost a Quit task so that the MessageLoop finishes up
// pending tasks and tasks posted by those pending tasks without risking the
// potential hang behavior of MessageLoop::QuitWhenIdle.
@@ -85,21 +78,17 @@ void RunThisRunLoop(base::RunLoop* run_loop) {
base::MessageLoop::ScopedNestableTaskAllower allow(
base::MessageLoop::current());
- for (size_t i = 0; i < g_pre_run_message_loop_hooks.Get().size(); i++)
- g_pre_run_message_loop_hooks.Get()[i].Run(run_loop);
-
+ // 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;
+#if !defined(OS_IOS)
+ delegate = GetCurrentTestLauncherDelegate();
+#endif
+ if (delegate)
+ delegate->PreRunMessageLoop(run_loop);
run_loop->Run();
-
- for (size_t i = 0; i < g_pre_run_message_loop_hooks.Get().size(); i++)
- g_post_run_message_loop_hooks.Get()[i].Run(run_loop);
-}
-
-void AddPreRunMessageLoopHook(const RunMessageLoopHook& hook) {
- g_pre_run_message_loop_hooks.Get().push_back(hook);
-}
-
-void AddPostRunMessageLoopHook(const RunMessageLoopHook& hook) {
- g_post_run_message_loop_hooks.Get().push_back(hook);
+ if (delegate)
+ delegate->PostRunMessageLoop();
}
void RunAllPendingInMessageLoop() {
« no previous file with comments | « content/public/test/test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698