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

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

Issue 11867023: content: remove NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 11 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 f2c445de2176445be6c487ca182200feae839d06..ab0fcd61309e861734e834eec1e0bc01a29b19ef 100644
--- a/content/public/test/test_utils.cc
+++ b/content/public/test/test_utils.cc
@@ -132,13 +132,22 @@ scoped_ptr<base::Value> ExecuteScriptAndGetValue(
return observer.result().Pass();
}
-MessageLoopRunner::MessageLoopRunner() {
+MessageLoopRunner::MessageLoopRunner()
+ : loop_running_(false),
+ quit_closure_called_(false) {
}
MessageLoopRunner::~MessageLoopRunner() {
}
void MessageLoopRunner::Run() {
+ // Do not run the message loop if our quit closure has already been called.
+ // This helps in scenarios where the closure has a chance to run before
+ // we Run explicitly.
+ if (quit_closure_called_)
+ return;
+
+ loop_running_ = true;
RunThisRunLoop(&run_loop_);
}
@@ -147,7 +156,13 @@ base::Closure MessageLoopRunner::QuitClosure() {
}
void MessageLoopRunner::Quit() {
- GetQuitTaskForRunLoop(&run_loop_).Run();
+ quit_closure_called_ = true;
+
+ // Only run the quit task if we are running the message loop.
+ if (loop_running_) {
+ GetQuitTaskForRunLoop(&run_loop_).Run();
+ loop_running_ = false;
+ }
}
WindowedNotificationObserver::WindowedNotificationObserver(
« 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