| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 BASE_TEST_IOS_WAIT_UTIL_H_ | 5 #ifndef BASE_TEST_IOS_WAIT_UTIL_H_ |
| 6 #define BASE_TEST_IOS_WAIT_UTIL_H_ | 6 #define BASE_TEST_IOS_WAIT_UTIL_H_ |
| 7 | 7 |
| 8 #include "base/ios/block_types.h" | 8 #include "base/ios/block_types.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 | 10 |
| 11 namespace base { | 11 namespace base { |
| 12 | |
| 13 class MessageLoop; | |
| 14 | |
| 15 namespace test { | 12 namespace test { |
| 16 namespace ios { | 13 namespace ios { |
| 17 | 14 |
| 18 // Runs |action| if non-nil. Then, until either |condition| is true or |timeout| | 15 // Runs |action| if non-nil. Then, until either |condition| is true or |timeout| |
| 19 // expires, repetitively runs the current NSRunLoop and the current MessageLoop | 16 // expires, repetitively runs the current NSRunLoop and the current MessageLoop |
| 20 // (if |run_message_loop| is true). |condition| may be nil if there is no | 17 // (if |run_message_loop| is true). |condition| may be nil if there is no |
| 21 // condition to wait for; the NSRunLoop and current MessageLoop will be run run | 18 // condition to wait for; the NSRunLoop and current MessageLoop will be run run |
| 22 // until |timeout| expires. DCHECKs if |condition| is non-nil and |timeout| | 19 // until |timeout| expires. DCHECKs if |condition| is non-nil and |timeout| |
| 23 // expires before |condition| becomes true. If |timeout| is zero, a reasonable | 20 // expires before |condition| becomes true. If |timeout| is zero, a reasonable |
| 24 // default is used. Returns the time spent in the function. | 21 // default is used. Returns the time spent in the function. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 36 // Lets the run loop of the current thread process other messages | 33 // Lets the run loop of the current thread process other messages |
| 37 // within the given maximum delay. This method may return before max_delay | 34 // within the given maximum delay. This method may return before max_delay |
| 38 // elapsed. | 35 // elapsed. |
| 39 void SpinRunLoopWithMaxDelay(TimeDelta max_delay); | 36 void SpinRunLoopWithMaxDelay(TimeDelta max_delay); |
| 40 | 37 |
| 41 // Lets the run loop of the current thread process other messages | 38 // Lets the run loop of the current thread process other messages |
| 42 // within the given minimum delay. This method returns after |min_delay| | 39 // within the given minimum delay. This method returns after |min_delay| |
| 43 // elapsed. | 40 // elapsed. |
| 44 void SpinRunLoopWithMinDelay(TimeDelta min_delay); | 41 void SpinRunLoopWithMinDelay(TimeDelta min_delay); |
| 45 | 42 |
| 46 // Deprecated. | |
| 47 // TODO(fdoray): Remove this once call have been removed from ios_internal. | |
| 48 TimeDelta TimeUntilCondition(ProceduralBlock action, | |
| 49 ConditionBlock condition, | |
| 50 MessageLoop* message_loop, | |
| 51 TimeDelta timeout); | |
| 52 | |
| 53 // Deprecated. | |
| 54 // TODO(fdoray): Remove this once call have been removed from ios_internal. | |
| 55 void WaitUntilCondition(ConditionBlock condition, | |
| 56 MessageLoop* message_loop, | |
| 57 TimeDelta timeout); | |
| 58 | |
| 59 } // namespace ios | 43 } // namespace ios |
| 60 } // namespace test | 44 } // namespace test |
| 61 } // namespace base | 45 } // namespace base |
| 62 | 46 |
| 63 #endif // BASE_TEST_IOS_WAIT_UTIL_H_ | 47 #endif // BASE_TEST_IOS_WAIT_UTIL_H_ |
| OLD | NEW |