| 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 #import "base/test/ios/wait_util.h" | 5 #import "base/test/ios/wait_util.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 WaitUntilCondition(condition, nullptr, TimeDelta()); | 50 WaitUntilCondition(condition, nullptr, TimeDelta()); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void SpinRunLoopWithMaxDelay(TimeDelta max_delay) { | 53 void SpinRunLoopWithMaxDelay(TimeDelta max_delay) { |
| 54 scoped_nsobject<NSDate> beforeDate( | 54 scoped_nsobject<NSDate> beforeDate( |
| 55 [[NSDate alloc] initWithTimeIntervalSinceNow:max_delay.InSecondsF()]); | 55 [[NSDate alloc] initWithTimeIntervalSinceNow:max_delay.InSecondsF()]); |
| 56 [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode | 56 [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode |
| 57 beforeDate:beforeDate]; | 57 beforeDate:beforeDate]; |
| 58 } | 58 } |
| 59 | 59 |
| 60 void SpinRunLoopWithMinDelay(TimeDelta min_delay) { |
| 61 ElapsedTimer timer; |
| 62 while (timer.Elapsed() < min_delay) { |
| 63 SpinRunLoopWithMaxDelay(base::TimeDelta::FromMilliseconds(10)); |
| 64 } |
| 65 } |
| 66 |
| 60 } // namespace ios | 67 } // namespace ios |
| 61 } // namespace test | 68 } // namespace test |
| 62 } // namespace base | 69 } // namespace base |
| OLD | NEW |