| Index: ios/testing/wait_util.mm
|
| diff --git a/ios/testing/earl_grey/wait_util.mm b/ios/testing/wait_util.mm
|
| similarity index 55%
|
| copy from ios/testing/earl_grey/wait_util.mm
|
| copy to ios/testing/wait_util.mm
|
| index e86ea432af5acf3c381c82d41b2196bccf22f046..d39636bd1ee6a32b770989ed5a2b333a713c3ba2 100644
|
| --- a/ios/testing/earl_grey/wait_util.mm
|
| +++ b/ios/testing/wait_util.mm
|
| @@ -2,9 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "ios/testing/earl_grey/wait_util.h"
|
| -
|
| -#import <EarlGrey/EarlGrey.h>
|
| +#import "ios/testing/wait_util.h"
|
|
|
| #include "base/test/ios/wait_util.h"
|
|
|
| @@ -15,20 +13,16 @@ const NSTimeInterval kWaitForJSCompletionTimeout = 2.0;
|
| const NSTimeInterval kWaitForUIElementTimeout = 4.0;
|
| const NSTimeInterval kWaitForDownloadTimeout = 10.0;
|
|
|
| -void WaitUntilCondition(NSTimeInterval timeout,
|
| - NSString* timeoutDescription,
|
| - bool (^condition)(void)) {
|
| +bool WaitUntilConditionOrTimeout(NSTimeInterval timeout,
|
| + ConditionBlock condition) {
|
| NSDate* deadline = [NSDate dateWithTimeIntervalSinceNow:timeout];
|
| - while (!condition() &&
|
| - [[NSDate date] compare:deadline] != NSOrderedDescending) {
|
| + bool success = condition();
|
| + while (!success && [[NSDate date] compare:deadline] != NSOrderedDescending) {
|
| base::test::ios::SpinRunLoopWithMaxDelay(
|
| base::TimeDelta::FromSecondsD(testing::kSpinDelaySeconds));
|
| + success = condition();
|
| }
|
| - GREYAssert(condition(), timeoutDescription);
|
| -}
|
| -
|
| -void WaitUntilCondition(NSTimeInterval timeout, bool (^condition)(void)) {
|
| - WaitUntilCondition(timeout, @"Timeout waiting for condition.", condition);
|
| + return success;
|
| }
|
|
|
| } // namespace testing
|
|
|