| 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(
|
|
|