| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_FRAME_TEST_CHROME_FRAME_TEST_UTILS_H_ | 5 #ifndef CHROME_FRAME_TEST_CHROME_FRAME_TEST_UTILS_H_ |
| 6 #define CHROME_FRAME_TEST_CHROME_FRAME_TEST_UTILS_H_ | 6 #define CHROME_FRAME_TEST_CHROME_FRAME_TEST_UTILS_H_ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 | 9 |
| 10 #include <atlbase.h> | 10 #include <atlbase.h> |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 public: | 183 public: |
| 184 TimedMsgLoop() : quit_loop_invoked_(false) { | 184 TimedMsgLoop() : quit_loop_invoked_(false) { |
| 185 } | 185 } |
| 186 | 186 |
| 187 void RunFor(int seconds) { | 187 void RunFor(int seconds) { |
| 188 QuitAfter(seconds); | 188 QuitAfter(seconds); |
| 189 quit_loop_invoked_ = false; | 189 quit_loop_invoked_ = false; |
| 190 loop_.MessageLoop::Run(); | 190 loop_.MessageLoop::Run(); |
| 191 } | 191 } |
| 192 | 192 |
| 193 void PostDelayedTask( | 193 void PostTask(const tracked_objects::Location& from_here, |
| 194 const tracked_objects::Location& from_here, Task* task, int64 delay_ms) { | 194 const base::Closure& task) { |
| 195 loop_.PostDelayedTask(from_here, task, delay_ms); | 195 loop_.PostTask(from_here, task); |
| 196 } |
| 197 |
| 198 void PostDelayedTask(const tracked_objects::Location& from_here, |
| 199 const base::Closure& task, int64 delay_ms) { |
| 200 loop_.PostDelayedTask(from_here, task, delay_ms); |
| 196 } | 201 } |
| 197 | 202 |
| 198 void Quit() { | 203 void Quit() { |
| 199 QuitAfter(0); | 204 QuitAfter(0); |
| 200 } | 205 } |
| 201 | 206 |
| 202 void QuitAfter(int seconds) { | 207 void QuitAfter(int seconds) { |
| 203 quit_loop_invoked_ = true; | 208 quit_loop_invoked_ = true; |
| 204 loop_.PostDelayedTask(FROM_HERE, new MessageLoop::QuitTask, 1000 * seconds); | 209 loop_.PostDelayedTask( |
| 210 FROM_HERE, MessageLoop::QuitClosure(), 1000 * seconds); |
| 205 } | 211 } |
| 206 | 212 |
| 207 bool WasTimedOut() const { | 213 bool WasTimedOut() const { |
| 208 return !quit_loop_invoked_; | 214 return !quit_loop_invoked_; |
| 209 } | 215 } |
| 210 | 216 |
| 211 private: | 217 private: |
| 212 MessageLoopForUI loop_; | 218 MessageLoopForUI loop_; |
| 213 bool quit_loop_invoked_; | 219 bool quit_loop_invoked_; |
| 214 }; | 220 }; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 } // namespace chrome_frame_test | 324 } // namespace chrome_frame_test |
| 319 | 325 |
| 320 // TODO(tommi): This is a temporary workaround while we're getting our | 326 // TODO(tommi): This is a temporary workaround while we're getting our |
| 321 // Singleton story straight. Ideally each test should clear up any singletons | 327 // Singleton story straight. Ideally each test should clear up any singletons |
| 322 // it might have created, but test cases do not implicitly have their own | 328 // it might have created, but test cases do not implicitly have their own |
| 323 // AtExitManager, so we have this workaround method for tests that depend on | 329 // AtExitManager, so we have this workaround method for tests that depend on |
| 324 // "fresh" singletons. The implementation is in chrome_frame_unittest_main.cc. | 330 // "fresh" singletons. The implementation is in chrome_frame_unittest_main.cc. |
| 325 void DeleteAllSingletons(); | 331 void DeleteAllSingletons(); |
| 326 | 332 |
| 327 #endif // CHROME_FRAME_TEST_CHROME_FRAME_TEST_UTILS_H_ | 333 #endif // CHROME_FRAME_TEST_CHROME_FRAME_TEST_UTILS_H_ |
| OLD | NEW |