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 "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 class RenderViewHost; | 27 class RenderViewHost; |
28 | 28 |
29 // Turns on nestable tasks, runs the message loop, then resets nestable tasks | 29 // Turns on nestable tasks, runs the message loop, then resets nestable tasks |
30 // to what they were originally. Prefer this over MessageLoop::Run for in | 30 // to what they were originally. Prefer this over MessageLoop::Run for in |
31 // process browser tests that need to block until a condition is met. | 31 // process browser tests that need to block until a condition is met. |
32 void RunMessageLoop(); | 32 void RunMessageLoop(); |
33 | 33 |
34 // Variant of RunMessageLoop that takes RunLoop. | 34 // Variant of RunMessageLoop that takes RunLoop. |
35 void RunThisRunLoop(base::RunLoop* run_loop); | 35 void RunThisRunLoop(base::RunLoop* run_loop); |
36 | 36 |
| 37 // Adds pre/post hooks to call when running a message loop. |
| 38 // DEPRECATED: Please do not use in new code. |
| 39 // TODO(phajdan.jr): Remove message loop hooks after switch to Aura. |
| 40 typedef base::Callback<void(base::RunLoop*)> RunMessageLoopHook; |
| 41 void AddPreRunMessageLoopHook(const RunMessageLoopHook& hook); |
| 42 void AddPostRunMessageLoopHook(const RunMessageLoopHook& hook); |
| 43 |
37 // Turns on nestable tasks, runs all pending tasks in the message loop, | 44 // Turns on nestable tasks, runs all pending tasks in the message loop, |
38 // then resets nestable tasks to what they were originally. Prefer this | 45 // then resets nestable tasks to what they were originally. Prefer this |
39 // over MessageLoop::RunAllPending for in process browser tests to run | 46 // over MessageLoop::RunAllPending for in process browser tests to run |
40 // all pending tasks. | 47 // all pending tasks. |
41 void RunAllPendingInMessageLoop(); | 48 void RunAllPendingInMessageLoop(); |
42 | 49 |
43 // Blocks the current thread until all the pending messages in the loop of the | 50 // Blocks the current thread until all the pending messages in the loop of the |
44 // thread |thread_id| have been processed. | 51 // thread |thread_id| have been processed. |
45 void RunAllPendingInMessageLoop(BrowserThread::ID thread_id); | 52 void RunAllPendingInMessageLoop(BrowserThread::ID thread_id); |
46 | 53 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 NotificationSource source_; | 148 NotificationSource source_; |
142 NotificationDetails details_; | 149 NotificationDetails details_; |
143 scoped_refptr<MessageLoopRunner> message_loop_runner_; | 150 scoped_refptr<MessageLoopRunner> message_loop_runner_; |
144 | 151 |
145 DISALLOW_COPY_AND_ASSIGN(WindowedNotificationObserver); | 152 DISALLOW_COPY_AND_ASSIGN(WindowedNotificationObserver); |
146 }; | 153 }; |
147 | 154 |
148 } // namespace content | 155 } // namespace content |
149 | 156 |
150 #endif // CONTENT_PUBLIC_TEST_TEST_UTILS_H_ | 157 #endif // CONTENT_PUBLIC_TEST_TEST_UTILS_H_ |
OLD | NEW |