Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2684)

Unified Diff: ios/web_view/test/web_view_test_util.mm

Issue 2940953003: Consolidated all CWVWebView test helpers inside web_view_test_util file. (Closed)
Patch Set: Addressed review comments Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/web_view/test/web_view_test_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ios/web_view/test/web_view_test_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698