| Index: ios/web/public/test/web_view_interaction_test_util.mm
|
| diff --git a/ios/web/public/test/web_view_interaction_test_util.mm b/ios/web/public/test/web_view_interaction_test_util.mm
|
| index db4000300e857f21bb245d6c750af05017db6fbd..73bbedeb05e23b4d9b8bb9a8e022a5ca162d0e85 100644
|
| --- a/ios/web/public/test/web_view_interaction_test_util.mm
|
| +++ b/ios/web/public/test/web_view_interaction_test_util.mm
|
| @@ -6,7 +6,7 @@
|
|
|
| #import <Foundation/Foundation.h>
|
|
|
| -#include "ios/testing/earl_grey/wait_util.h"
|
| +#include "base/test/ios/wait_util.h"
|
| #import "ios/web/web_state/ui/crw_web_controller.h"
|
| #include "ios/web/web_state/web_state_impl.h"
|
|
|
| @@ -15,6 +15,9 @@ using web::NavigationManager;
|
| namespace web {
|
| namespace test {
|
|
|
| +const NSTimeInterval kWaitForJSCompletionTimeout = 2.0;
|
| +const NSTimeInterval kSpinDelaySeconds = 0.01;
|
| +
|
| enum ElementAction { ELEMENT_ACTION_CLICK, ELEMENT_ACTION_FOCUS };
|
|
|
| // Returns whether the Javascript action specified by |action| ran on
|
| @@ -51,11 +54,15 @@ bool RunActionOnWebViewElementWithId(web::WebState* web_state,
|
| element_found = [result boolValue];
|
| }];
|
|
|
| - testing::WaitUntilCondition(testing::kWaitForJSCompletionTimeout, ^{
|
| - return did_complete;
|
| - });
|
| + NSDate* deadline =
|
| + [NSDate dateWithTimeIntervalSinceNow:kWaitForJSCompletionTimeout];
|
| + while (!did_complete &&
|
| + [[NSDate date] compare:deadline] != NSOrderedDescending) {
|
| + base::test::ios::SpinRunLoopWithMaxDelay(
|
| + base::TimeDelta::FromSecondsD(kSpinDelaySeconds));
|
| + }
|
|
|
| - return element_found;
|
| + return did_complete && element_found;
|
| }
|
|
|
| bool TapWebViewElementWithId(web::WebState* web_state,
|
|
|