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/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 // Run the current MessageLoop. | 35 // Run the current MessageLoop. |
36 void Run(); | 36 void Run(); |
37 | 37 |
38 // Quit the matching call to Run (nested MessageLoops are unaffected). | 38 // Quit the matching call to Run (nested MessageLoops are unaffected). |
39 void Quit(); | 39 void Quit(); |
40 | 40 |
41 // Hand this closure off to code that uses callbacks to notify completion. | 41 // Hand this closure off to code that uses callbacks to notify completion. |
42 // Example: | 42 // Example: |
43 // scoped_refptr<MessageLoopRunner> runner = new MessageLoopRunner; | 43 // scoped_refptr<MessageLoopRunner> runner = new MessageLoopRunner; |
44 // kick_off_some_api(runner.QuitNowClosure()); | 44 // kick_off_some_api(runner->QuitClosure()); |
45 // runner.Run(); | 45 // runner->Run(); |
46 base::Closure QuitClosure(); | 46 base::Closure QuitClosure(); |
47 | 47 |
48 private: | 48 private: |
49 friend class base::RefCounted<MessageLoopRunner>; | 49 friend class base::RefCounted<MessageLoopRunner>; |
50 ~MessageLoopRunner(); | 50 ~MessageLoopRunner(); |
51 | 51 |
52 base::RunLoop run_loop_; | 52 base::RunLoop run_loop_; |
53 | 53 |
54 DISALLOW_COPY_AND_ASSIGN(MessageLoopRunner); | 54 DISALLOW_COPY_AND_ASSIGN(MessageLoopRunner); |
55 }; | 55 }; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 NotificationSource source_; | 103 NotificationSource source_; |
104 NotificationDetails details_; | 104 NotificationDetails details_; |
105 scoped_refptr<MessageLoopRunner> message_loop_runner_; | 105 scoped_refptr<MessageLoopRunner> message_loop_runner_; |
106 | 106 |
107 DISALLOW_COPY_AND_ASSIGN(WindowedNotificationObserver); | 107 DISALLOW_COPY_AND_ASSIGN(WindowedNotificationObserver); |
108 }; | 108 }; |
109 | 109 |
110 } // namespace content | 110 } // namespace content |
111 | 111 |
112 #endif // CONTENT_PUBLIC_TEST_TEST_UTILS_H_ | 112 #endif // CONTENT_PUBLIC_TEST_TEST_UTILS_H_ |
OLD | NEW |