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 896639a0f6e1a17e4c9e92398ce87ad199ffbc13..2290c0619c0e38c7cecff0519f08807cf95cd4bc 100644 |
--- a/ios/web/public/test/web_view_interaction_test_util.mm |
+++ b/ios/web/public/test/web_view_interaction_test_util.mm |
@@ -27,14 +27,9 @@ void TapWebViewElementWithId(web::WebState* web_state, |
did_complete = true; |
})); |
- // TODO(crbug.com/610837): Re-factor wait code into common location. |
- NSDate* deadline = [NSDate |
- dateWithTimeIntervalSinceNow:testing::kWaitForJSCompletionTimeout]; |
- while (([[NSDate date] compare:deadline] != NSOrderedDescending) && |
- !did_complete) { |
- base::test::ios::SpinRunLoopWithMaxDelay( |
- base::TimeDelta::FromSecondsD(testing::kSpinDelaySeconds)); |
- } |
+ testing::WaitUntilCondition(testing::kWaitForJSCompletionTimeout, ^{ |
+ return did_complete; |
+ }); |
} |
} // namespace test |