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.h" | 8 #include "base/callback.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 | |
44 // Turns on nestable tasks, runs all pending tasks in the message loop, | 37 // Turns on nestable tasks, runs all pending tasks in the message loop, |
45 // then resets nestable tasks to what they were originally. Prefer this | 38 // then resets nestable tasks to what they were originally. Prefer this |
46 // over MessageLoop::RunAllPending for in process browser tests to run | 39 // over MessageLoop::RunAllPending for in process browser tests to run |
47 // all pending tasks. | 40 // all pending tasks. |
48 void RunAllPendingInMessageLoop(); | 41 void RunAllPendingInMessageLoop(); |
49 | 42 |
50 // Blocks the current thread until all the pending messages in the loop of the | 43 // Blocks the current thread until all the pending messages in the loop of the |
51 // thread |thread_id| have been processed. | 44 // thread |thread_id| have been processed. |
52 void RunAllPendingInMessageLoop(BrowserThread::ID thread_id); | 45 void RunAllPendingInMessageLoop(BrowserThread::ID thread_id); |
53 | 46 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 NotificationSource source_; | 165 NotificationSource source_; |
173 NotificationDetails details_; | 166 NotificationDetails details_; |
174 scoped_refptr<MessageLoopRunner> message_loop_runner_; | 167 scoped_refptr<MessageLoopRunner> message_loop_runner_; |
175 | 168 |
176 DISALLOW_COPY_AND_ASSIGN(WindowedNotificationObserver); | 169 DISALLOW_COPY_AND_ASSIGN(WindowedNotificationObserver); |
177 }; | 170 }; |
178 | 171 |
179 } // namespace content | 172 } // namespace content |
180 | 173 |
181 #endif // CONTENT_PUBLIC_TEST_TEST_UTILS_H_ | 174 #endif // CONTENT_PUBLIC_TEST_TEST_UTILS_H_ |
OLD | NEW |