| 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
|
|
|