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

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

Issue 2784943002: Remove matcher to wait for static HTML view. (Closed)
Patch Set: more better comments Created 3 years, 9 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 efbd2d3fef7d377ce8674f3420ac9e1d15c28355..f370ae32b9babf659a3d571c619007d7af373606 100644
--- a/ios/chrome/test/earl_grey/chrome_earl_grey.mm
+++ b/ios/chrome/test/earl_grey/chrome_earl_grey.mm
@@ -9,14 +9,19 @@
#include "base/mac/foundation_util.h"
#include "base/strings/sys_string_conversions.h"
+#import "base/test/ios/wait_util.h"
+#include "components/strings/grit/components_strings.h"
+#import "ios/chrome/browser/ui/static_content/static_html_view_controller.h"
#import "ios/chrome/test/app/chrome_test_util.h"
#import "ios/chrome/test/app/history_test_util.h"
#include "ios/chrome/test/app/navigation_test_util.h"
+#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_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"
+#include "ui/base/l10n/l10n_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
@@ -125,4 +130,26 @@ id ExecuteJavaScript(NSString* javascript,
elementID);
}
++ (void)waitForErrorPage {
+ NSString* const kInternetDisconnectedError =
+ l10n_util::GetNSString(IDS_ERRORPAGES_HEADING_NOT_AVAILABLE);
+ [self waitForStaticHTMLViewContainingText:kInternetDisconnectedError
+ isTextPresent:YES];
+}
+
++ (void)waitForStaticHTMLViewContainingText:(NSString*)text
+ isTextPresent:(BOOL)present {
+ GREYCondition* condition = [GREYCondition
+ conditionWithName:@"Wait for page to complete loading."
+ block:^BOOL {
+ return present ==
+ chrome_test_util::StaticHtmlViewContainingText(
+ chrome_test_util::GetCurrentWebState(),
+ base::SysNSStringToUTF8(text));
+ }];
+ GREYAssert([condition waitWithTimeout:testing::kWaitForUIElementTimeout],
+ @"Failed to find static html view %@containing %@",
+ present ? @"" : @"not ", text);
+}
+
@end

Powered by Google App Engine
This is Rietveld 408576698