Index: ios/web_view/test/web_view_test_util.mm |
diff --git a/ios/web_view/test/web_view_test_util.mm b/ios/web_view/test/web_view_test_util.mm |
index 8ed4bc6a71e5ff04e19ac5d4399d17c5367f6869..f2538708a581a572e074e5983d96fbf18e70d594 100644 |
--- a/ios/web_view/test/web_view_test_util.mm |
+++ b/ios/web_view/test/web_view_test_util.mm |
@@ -23,7 +23,13 @@ CWVWebView* CreateWebView() { |
configuration:[CWVWebViewConfiguration defaultConfiguration]]; |
} |
-bool TapChromeWebViewElementWithId(CWVWebView* web_view, NSString* element_id) { |
+bool LoadUrl(CWVWebView* web_view, NSURL* url) { |
+ [web_view loadRequest:[NSURLRequest requestWithURL:url]]; |
+ |
+ return WaitForWebViewLoadCompletionOrTimeout(web_view); |
+} |
+ |
+bool TapWebViewElementWithId(CWVWebView* web_view, NSString* element_id) { |
// TODO(crbug.com/725524): Share this script with Chrome. |
NSString* script = [NSString |
stringWithFormat:@"(function() {" |
@@ -68,5 +74,11 @@ bool WaitForWebViewContainingTextOrTimeout(CWVWebView* web_view, |
}); |
} |
+bool WaitForWebViewLoadCompletionOrTimeout(CWVWebView* web_view) { |
+ return WaitUntilConditionOrTimeout(testing::kWaitForPageLoadTimeout, ^{ |
+ return !web_view.loading; |
+ }); |
+} |
+ |
} // namespace test |
} // namespace ios_web_view |