OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/public/test/test_utils.h" | 5 #include "content/public/test/test_utils.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 private: | 67 private: |
68 scoped_ptr<base::Value> result_; | 68 scoped_ptr<base::Value> result_; |
69 | 69 |
70 DISALLOW_COPY_AND_ASSIGN(ScriptCallback); | 70 DISALLOW_COPY_AND_ASSIGN(ScriptCallback); |
71 }; | 71 }; |
72 | 72 |
73 void ScriptCallback::ResultCallback(const base::Value* result) { | 73 void ScriptCallback::ResultCallback(const base::Value* result) { |
74 if (result) | 74 if (result) |
75 result_.reset(result->DeepCopy()); | 75 result_.reset(result->DeepCopy()); |
76 base::MessageLoop::current()->Quit(); | 76 base::MessageLoop::current()->QuitWhenIdle(); |
77 } | 77 } |
78 | 78 |
79 // Monitors if any task is processed by the message loop. | 79 // Monitors if any task is processed by the message loop. |
80 class TaskObserver : public base::MessageLoop::TaskObserver { | 80 class TaskObserver : public base::MessageLoop::TaskObserver { |
81 public: | 81 public: |
82 TaskObserver() : processed_(false) {} | 82 TaskObserver() : processed_(false) {} |
83 ~TaskObserver() override {} | 83 ~TaskObserver() override {} |
84 | 84 |
85 // MessageLoop::TaskObserver overrides. | 85 // MessageLoop::TaskObserver overrides. |
86 void WillProcessTask(const base::PendingTask& pending_task) override {} | 86 void WillProcessTask(const base::PendingTask& pending_task) override {} |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 | 369 |
370 void WebContentsDestroyedWatcher::Wait() { | 370 void WebContentsDestroyedWatcher::Wait() { |
371 message_loop_runner_->Run(); | 371 message_loop_runner_->Run(); |
372 } | 372 } |
373 | 373 |
374 void WebContentsDestroyedWatcher::WebContentsDestroyed() { | 374 void WebContentsDestroyedWatcher::WebContentsDestroyed() { |
375 message_loop_runner_->Quit(); | 375 message_loop_runner_->Quit(); |
376 } | 376 } |
377 | 377 |
378 } // namespace content | 378 } // namespace content |
OLD | NEW |