| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 RunThisRunLoop(&run_loop); | 122 RunThisRunLoop(&run_loop); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void RunThisRunLoop(base::RunLoop* run_loop) { | 125 void RunThisRunLoop(base::RunLoop* run_loop) { |
| 126 base::MessageLoop::ScopedNestableTaskAllower allow( | 126 base::MessageLoop::ScopedNestableTaskAllower allow( |
| 127 base::MessageLoop::current()); | 127 base::MessageLoop::current()); |
| 128 | 128 |
| 129 // If we're running inside a browser test, we might need to allow the test | 129 // If we're running inside a browser test, we might need to allow the test |
| 130 // launcher to do extra work before/after running a nested message loop. | 130 // launcher to do extra work before/after running a nested message loop. |
| 131 TestLauncherDelegate* delegate = NULL; | 131 TestLauncherDelegate* delegate = NULL; |
| 132 #if !defined(OS_IOS) | |
| 133 delegate = GetCurrentTestLauncherDelegate(); | 132 delegate = GetCurrentTestLauncherDelegate(); |
| 134 #endif | |
| 135 if (delegate) | 133 if (delegate) |
| 136 delegate->PreRunMessageLoop(run_loop); | 134 delegate->PreRunMessageLoop(run_loop); |
| 137 run_loop->Run(); | 135 run_loop->Run(); |
| 138 if (delegate) | 136 if (delegate) |
| 139 delegate->PostRunMessageLoop(); | 137 delegate->PostRunMessageLoop(); |
| 140 } | 138 } |
| 141 | 139 |
| 142 void RunAllPendingInMessageLoop() { | 140 void RunAllPendingInMessageLoop() { |
| 143 base::RunLoop run_loop; | 141 base::RunLoop run_loop; |
| 144 base::ThreadTaskRunnerHandle::Get()->PostTask( | 142 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 | 380 |
| 383 void WebContentsDestroyedWatcher::Wait() { | 381 void WebContentsDestroyedWatcher::Wait() { |
| 384 message_loop_runner_->Run(); | 382 message_loop_runner_->Run(); |
| 385 } | 383 } |
| 386 | 384 |
| 387 void WebContentsDestroyedWatcher::WebContentsDestroyed() { | 385 void WebContentsDestroyedWatcher::WebContentsDestroyed() { |
| 388 message_loop_runner_->Quit(); | 386 message_loop_runner_->Quit(); |
| 389 } | 387 } |
| 390 | 388 |
| 391 } // namespace content | 389 } // namespace content |
| OLD | NEW |