| 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 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 loop_.MessageLoop::Run(); | 197 loop_.MessageLoop::Run(); |
| 198 } | 198 } |
| 199 | 199 |
| 200 void PostTask(const tracked_objects::Location& from_here, | 200 void PostTask(const tracked_objects::Location& from_here, |
| 201 const base::Closure& task) { | 201 const base::Closure& task) { |
| 202 loop_.PostTask(from_here, task); | 202 loop_.PostTask(from_here, task); |
| 203 } | 203 } |
| 204 | 204 |
| 205 void PostDelayedTask(const tracked_objects::Location& from_here, | 205 void PostDelayedTask(const tracked_objects::Location& from_here, |
| 206 const base::Closure& task, int64 delay_ms) { | 206 const base::Closure& task, int64 delay_ms) { |
| 207 loop_.PostDelayedTask(from_here, task, delay_ms); | 207 loop_.PostDelayedTask( |
| 208 from_here, task, base::TimeDelta::FromMilliseconds(delay_ms)); |
| 208 } | 209 } |
| 209 | 210 |
| 210 void Quit() { | 211 void Quit() { |
| 211 QuitAfter(0); | 212 QuitAfter(0); |
| 212 } | 213 } |
| 213 | 214 |
| 214 void QuitAfter(int seconds) { | 215 void QuitAfter(int seconds) { |
| 215 quit_loop_invoked_ = true; | 216 quit_loop_invoked_ = true; |
| 216 loop_.PostDelayedTask( | 217 loop_.PostDelayedTask(FROM_HERE, |
| 217 FROM_HERE, MessageLoop::QuitClosure(), 1000 * seconds); | 218 MessageLoop::QuitClosure(), base::TimeDelta::FromSeconds(seconds)); |
| 218 } | 219 } |
| 219 | 220 |
| 220 bool WasTimedOut() const { | 221 bool WasTimedOut() const { |
| 221 return !quit_loop_invoked_; | 222 return !quit_loop_invoked_; |
| 222 } | 223 } |
| 223 | 224 |
| 224 private: | 225 private: |
| 225 MessageLoopForUI loop_; | 226 MessageLoopForUI loop_; |
| 226 bool quit_loop_invoked_; | 227 bool quit_loop_invoked_; |
| 227 }; | 228 }; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 } // namespace chrome_frame_test | 332 } // namespace chrome_frame_test |
| 332 | 333 |
| 333 // TODO(tommi): This is a temporary workaround while we're getting our | 334 // TODO(tommi): This is a temporary workaround while we're getting our |
| 334 // Singleton story straight. Ideally each test should clear up any singletons | 335 // Singleton story straight. Ideally each test should clear up any singletons |
| 335 // it might have created, but test cases do not implicitly have their own | 336 // it might have created, but test cases do not implicitly have their own |
| 336 // AtExitManager, so we have this workaround method for tests that depend on | 337 // AtExitManager, so we have this workaround method for tests that depend on |
| 337 // "fresh" singletons. The implementation is in chrome_frame_unittest_main.cc. | 338 // "fresh" singletons. The implementation is in chrome_frame_unittest_main.cc. |
| 338 void DeleteAllSingletons(); | 339 void DeleteAllSingletons(); |
| 339 | 340 |
| 340 #endif // CHROME_FRAME_TEST_CHROME_FRAME_TEST_UTILS_H_ | 341 #endif // CHROME_FRAME_TEST_CHROME_FRAME_TEST_UTILS_H_ |
| OLD | NEW |