| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import <EarlGrey/EarlGrey.h> | 5 #import <EarlGrey/EarlGrey.h> |
| 6 | 6 |
| 7 #include "components/strings/grit/components_strings.h" | 7 #include "components/strings/grit/components_strings.h" |
| 8 #import "ios/chrome/test/app/chrome_test_util.h" | 8 #import "ios/chrome/test/app/chrome_test_util.h" |
| 9 #include "ios/chrome/test/app/web_view_interaction_test_util.h" | 9 #include "ios/chrome/test/app/web_view_interaction_test_util.h" |
| 10 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" | 10 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 assertWithMatcher:grey_notNil()]; | 63 assertWithMatcher:grey_notNil()]; |
| 64 const std::string kError = | 64 const std::string kError = |
| 65 l10n_util::GetStringUTF8(IDS_ERRORPAGES_HEADING_NOT_AVAILABLE); | 65 l10n_util::GetStringUTF8(IDS_ERRORPAGES_HEADING_NOT_AVAILABLE); |
| 66 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kError)] | 66 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kError)] |
| 67 assertWithMatcher:grey_nil()]; | 67 assertWithMatcher:grey_nil()]; |
| 68 } | 68 } |
| 69 | 69 |
| 70 #pragma mark - tests | 70 #pragma mark - tests |
| 71 | 71 |
| 72 // Tests whether the error page is displayed for a bad URL. | 72 // Tests whether the error page is displayed for a bad URL. |
| 73 - (void)testErrorPage { | 73 // TODO(crbug.com/684987): Re-enable this test. |
| 74 - (void)DISABLED_testErrorPage { |
| 74 std::unique_ptr<web::DataResponseProvider> provider( | 75 std::unique_ptr<web::DataResponseProvider> provider( |
| 75 new ErrorPageResponseProvider()); | 76 new ErrorPageResponseProvider()); |
| 76 web::test::SetUpHttpServer(std::move(provider)); | 77 web::test::SetUpHttpServer(std::move(provider)); |
| 77 | 78 |
| 78 [ChromeEarlGrey loadURL:ErrorPageResponseProvider::GetDnsFailureUrl()]; | 79 [ChromeEarlGrey loadURL:ErrorPageResponseProvider::GetDnsFailureUrl()]; |
| 79 | 80 |
| 80 [self checkErrorPageIsVisible]; | 81 [self checkErrorPageIsVisible]; |
| 81 } | 82 } |
| 82 | 83 |
| 83 // Tests whether the error page is displayed if it is behind a redirect. | 84 // Tests whether the error page is displayed if it is behind a redirect. |
| 84 - (void)testErrorPageRedirect { | 85 // TODO(crbug.com/684987): Re-enable this test. |
| 86 - (void)DISABLED_testErrorPageRedirect { |
| 85 std::unique_ptr<web::DataResponseProvider> provider( | 87 std::unique_ptr<web::DataResponseProvider> provider( |
| 86 new ErrorPageResponseProvider()); | 88 new ErrorPageResponseProvider()); |
| 87 web::test::SetUpHttpServer(std::move(provider)); | 89 web::test::SetUpHttpServer(std::move(provider)); |
| 88 | 90 |
| 89 // Load a URL that redirects to the DNS-failing URL. | 91 // Load a URL that redirects to the DNS-failing URL. |
| 90 [ChromeEarlGrey | 92 [ChromeEarlGrey |
| 91 loadURL:ErrorPageResponseProvider::GetRedirectToDnsFailureUrl()]; | 93 loadURL:ErrorPageResponseProvider::GetRedirectToDnsFailureUrl()]; |
| 92 | 94 |
| 93 // Verify that the redirect occurred before checking for the DNS error. | 95 // Verify that the redirect occurred before checking for the DNS error. |
| 94 const std::string& redirectedURL = | 96 const std::string& redirectedURL = |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 [ChromeEarlGrey loadURL:URL]; | 179 [ChromeEarlGrey loadURL:URL]; |
| 178 TapWebViewElementWithId(kButtonId); | 180 TapWebViewElementWithId(kButtonId); |
| 179 // Check that the timer has completed. | 181 // Check that the timer has completed. |
| 180 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kTimerCompleted)] | 182 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kTimerCompleted)] |
| 181 assertWithMatcher:grey_notNil()]; | 183 assertWithMatcher:grey_notNil()]; |
| 182 // DNS error page should still not appear. | 184 // DNS error page should still not appear. |
| 183 [self checkErrorPageIsNotVisible]; | 185 [self checkErrorPageIsNotVisible]; |
| 184 } | 186 } |
| 185 | 187 |
| 186 @end | 188 @end |
| OLD | NEW |