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

Unified Diff: ios/chrome/test/earl_grey/chrome_earl_grey.mm

Issue 2798773002: Create ChromeEarlGrey waitForWebViewContainingText. (Closed)
Patch Set: more cleanup 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
Index: ios/chrome/test/earl_grey/chrome_earl_grey.mm
diff --git a/ios/chrome/test/earl_grey/chrome_earl_grey.mm b/ios/chrome/test/earl_grey/chrome_earl_grey.mm
index 970abc0bfd4276df1e472516718046323abc77de..207312e4003420a0aa8d511a4d68da016d0d6676 100644
--- a/ios/chrome/test/earl_grey/chrome_earl_grey.mm
+++ b/ios/chrome/test/earl_grey/chrome_earl_grey.mm
@@ -21,6 +21,7 @@
#import "ios/chrome/test/app/static_html_view_test_util.h"
#import "ios/testing/wait_util.h"
#import "ios/web/public/test/earl_grey/js_test_util.h"
+#import "ios/web/public/test/web_view_content_test_util.h"
#import "ios/web/public/test/web_view_interaction_test_util.h"
#import "ios/web/public/web_state/js/crw_js_injection_receiver.h"
#import "ios/web/public/web_state/web_state.h"
@@ -184,4 +185,14 @@ id ExecuteJavaScript(NSString* javascript,
@"Failed, there was a static html view containing %@", text);
}
++ (void)waitForWebViewContainingText:(std::string)text {
+ GREYCondition* condition = [GREYCondition
+ conditionWithName:@"Wait for web view containing text"
+ block:^BOOL {
+ return web::test::WebViewContainingText(
+ chrome_test_util::GetCurrentWebState(), text);
+ }];
+ GREYAssert([condition waitWithTimeout:testing::kWaitForUIElementTimeout],
+ @"Failed waiting for web view containing %s", text.c_str());
+}
@end

Powered by Google App Engine
This is Rietveld 408576698