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

Unified Diff: ios/web/shell/test/earl_grey/shell_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/web/shell/test/earl_grey/shell_earl_grey.mm
diff --git a/ios/web/shell/test/earl_grey/shell_earl_grey.mm b/ios/web/shell/test/earl_grey/shell_earl_grey.mm
index bdf8f1b47face21f3577251265b48677eb79864c..7c25ee2b8fc094cbfccfc09658037b568618c169 100644
--- a/ios/web/shell/test/earl_grey/shell_earl_grey.mm
+++ b/ios/web/shell/test/earl_grey/shell_earl_grey.mm
@@ -6,8 +6,10 @@
#import <EarlGrey/EarlGrey.h>
+#include "base/strings/sys_string_conversions.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"
#include "ios/web/shell/test/app/navigation_test_util.h"
#import "ios/web/shell/test/app/web_shell_test_util.h"
@@ -40,4 +42,16 @@
[[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
}
++ (void)waitForWebViewContainingText:(NSString*)text {
+ GREYCondition* condition = [GREYCondition
+ conditionWithName:@"Wait for web view containing text"
+ block:^BOOL {
+ return web::test::WebViewContainingText(
+ web::shell_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