| 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 #ifndef CONTENT_PUBLIC_TEST_TEST_UTILS_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_TEST_UTILS_H_ |
| 6 #define CONTENT_PUBLIC_TEST_TEST_UTILS_H_ | 6 #define CONTENT_PUBLIC_TEST_TEST_UTILS_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // to what they were originally. Prefer this over MessageLoop::Run for in | 41 // to what they were originally. Prefer this over MessageLoop::Run for in |
| 42 // process browser tests that need to block until a condition is met. | 42 // process browser tests that need to block until a condition is met. |
| 43 void RunMessageLoop(); | 43 void RunMessageLoop(); |
| 44 | 44 |
| 45 // Variant of RunMessageLoop that takes RunLoop. | 45 // Variant of RunMessageLoop that takes RunLoop. |
| 46 void RunThisRunLoop(base::RunLoop* run_loop); | 46 void RunThisRunLoop(base::RunLoop* run_loop); |
| 47 | 47 |
| 48 // Turns on nestable tasks, runs all pending tasks in the message loop, | 48 // Turns on nestable tasks, runs all pending tasks in the message loop, |
| 49 // then resets nestable tasks to what they were originally. Prefer this | 49 // then resets nestable tasks to what they were originally. Prefer this |
| 50 // over MessageLoop::RunAllPending for in process browser tests to run | 50 // over MessageLoop::RunAllPending for in process browser tests to run |
| 51 // all pending tasks. | 51 // all pending tasks. Can only be called from the UI thread. |
| 52 void RunAllPendingInMessageLoop(); | 52 void RunAllPendingInMessageLoop(); |
| 53 | 53 |
| 54 // Blocks the current thread until all the pending messages in the loop of the | 54 // Blocks the current thread until all the pending messages in the loop of the |
| 55 // thread |thread_id| have been processed. | 55 // thread |thread_id| have been processed. Can only be called from the UI |
| 56 // thread. |
| 56 void RunAllPendingInMessageLoop(BrowserThread::ID thread_id); | 57 void RunAllPendingInMessageLoop(BrowserThread::ID thread_id); |
| 57 | 58 |
| 58 // Runs until both the blocking pool and the current message loop are empty | 59 // Runs until both the blocking pool and the current message loop are empty |
| 59 // (have no more scheduled tasks) and no tasks are running. | 60 // (have no more scheduled tasks) and no tasks are running. |
| 60 void RunAllBlockingPoolTasksUntilIdle(); | 61 void RunAllBlockingPoolTasksUntilIdle(); |
| 61 | 62 |
| 62 // Get task to quit the given RunLoop. It allows a few generations of pending | 63 // Get task to quit the given RunLoop. It allows a few generations of pending |
| 63 // tasks to run as opposed to run_loop->QuitClosure(). | 64 // tasks to run as opposed to run_loop->QuitClosure(). |
| 64 base::Closure GetQuitTaskForRunLoop(base::RunLoop* run_loop); | 65 base::Closure GetQuitTaskForRunLoop(base::RunLoop* run_loop); |
| 65 | 66 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 void WebContentsDestroyed() override; | 283 void WebContentsDestroyed() override; |
| 283 | 284 |
| 284 scoped_refptr<MessageLoopRunner> message_loop_runner_; | 285 scoped_refptr<MessageLoopRunner> message_loop_runner_; |
| 285 | 286 |
| 286 DISALLOW_COPY_AND_ASSIGN(WebContentsDestroyedWatcher); | 287 DISALLOW_COPY_AND_ASSIGN(WebContentsDestroyedWatcher); |
| 287 }; | 288 }; |
| 288 | 289 |
| 289 } // namespace content | 290 } // namespace content |
| 290 | 291 |
| 291 #endif // CONTENT_PUBLIC_TEST_TEST_UTILS_H_ | 292 #endif // CONTENT_PUBLIC_TEST_TEST_UTILS_H_ |
| OLD | NEW |