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

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

Issue 2798773002: Create ChromeEarlGrey waitForWebViewContainingText. (Closed)
Patch Set: better formatting Created 3 years, 8 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..2db43509709827bedc4bc17dd22c3c287d38eea8 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,15 @@ id ExecuteJavaScript(NSString* javascript,
@"Failed, there was a static html view containing %@", text);
}
++ (void)waitForWebViewContainingText:(NSString*)text {
+ GREYCondition* condition =
+ [GREYCondition conditionWithName:@"Wait for web view containing text"
+ block:^BOOL {
+ return web::test::WebViewContainingText(
+ chrome_test_util::GetCurrentWebState(),
+ base::SysNSStringToUTF8(text));
+ }];
+ GREYAssert([condition waitWithTimeout:testing::kWaitForUIElementTimeout],
+ @"Failed waiting for web view containing %@", text);
+}
@end

Powered by Google App Engine
This is Rietveld 408576698