Index: ios/web/public/test/web_test_with_web_state.mm |
diff --git a/ios/web/public/test/web_test_with_web_state.mm b/ios/web/public/test/web_test_with_web_state.mm |
index b3c67a6afbd7a0166e2f41356aba4d9ef8628386..764731d9501a51cfee827324e24572d597d94fe2 100644 |
--- a/ios/web/public/test/web_test_with_web_state.mm |
+++ b/ios/web/public/test/web_test_with_web_state.mm |
@@ -71,10 +71,10 @@ void WebTestWithWebState::LoadHtml(NSString* html, const GURL& url) { |
return web_controller.loadPhase == PAGE_LOADED; |
}); |
- // Wait until scripts execution becomes possible. |
- base::test::ios::WaitUntilCondition(^bool { |
- return [ExecuteJavaScript(@"0;") isEqual:@0]; |
- }); |
+ // Reload the page if script execution is not possible. |
+ if (![ExecuteJavaScript(@"0;") isEqual:@0]) { |
+ LoadHtml(html, url); |
+ } |
} |
void WebTestWithWebState::LoadHtml(NSString* html) { |