| 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 <XCTest/XCTest.h> | 5 #import <XCTest/XCTest.h> |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "components/strings/grit/components_strings.h" | 8 #include "components/strings/grit/components_strings.h" |
| 9 #import "ios/chrome/browser/ui/browser_view_controller_dependency_factory.h" | 9 #import "ios/chrome/browser/ui/browser_view_controller_dependency_factory.h" |
| 10 #import "ios/chrome/browser/ui/uikit_ui_util.h" | 10 #import "ios/chrome/browser/ui/uikit_ui_util.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 } // namespace | 48 } // namespace |
| 49 | 49 |
| 50 // Earl grey integration tests for Activity Service Controller. | 50 // Earl grey integration tests for Activity Service Controller. |
| 51 @interface ActivityServiceControllerTestCase : ChromeTestCase | 51 @interface ActivityServiceControllerTestCase : ChromeTestCase |
| 52 @end | 52 @end |
| 53 | 53 |
| 54 @implementation ActivityServiceControllerTestCase | 54 @implementation ActivityServiceControllerTestCase |
| 55 | 55 |
| 56 // Test that when trying to print a page redirected to an unprintable page, a | 56 // Test that when trying to print a page redirected to an unprintable page, a |
| 57 // snackbar explaining that the page cannot be printed is displayed. | 57 // snackbar explaining that the page cannot be printed is displayed. |
| 58 // TODO(crbug.com/684987): Re-enable this test. | 58 - (void)testActivityServiceControllerPrintAfterRedirectionToUnprintablePage { |
| 59 - (void) | |
| 60 DISABLED_testActivityServiceControllerPrintAfterRedirectionToUnprintablePage
{ | |
| 61 std::map<GURL, std::string> responses; | 59 std::map<GURL, std::string> responses; |
| 62 const GURL regularPageURL = web::test::HttpServer::MakeUrl("http://choux"); | 60 const GURL regularPageURL = web::test::HttpServer::MakeUrl("http://choux"); |
| 63 responses[regularPageURL] = "fleur"; | 61 responses[regularPageURL] = "fleur"; |
| 64 web::test::SetUpHttpServer( | 62 web::test::SetUpHttpServer( |
| 65 base::MakeUnique<ErrorPageResponseProvider>(responses)); | 63 base::MakeUnique<ErrorPageResponseProvider>(responses)); |
| 66 | 64 |
| 67 // Open a regular page and verify that you can share. | 65 // Open a regular page and verify that you can share. |
| 68 [ChromeEarlGrey loadURL:regularPageURL]; | 66 [ChromeEarlGrey loadURL:regularPageURL]; |
| 69 [ChromeEarlGreyUI openShareMenu]; | 67 [ChromeEarlGreyUI openShareMenu]; |
| 70 AssertActivityServiceVisible(); | 68 AssertActivityServiceVisible(); |
| 71 | 69 |
| 72 // Open an error page. | 70 // Open an error page. |
| 73 [ChromeEarlGrey loadURL:ErrorPageResponseProvider::GetDnsFailureUrl()]; | 71 [ChromeEarlGrey loadURL:ErrorPageResponseProvider::GetDnsFailureUrl()]; |
| 74 id<GREYMatcher> webViewMatcher = | |
| 75 web::WebViewInWebState(chrome_test_util::GetCurrentWebState()); | |
| 76 [[EarlGrey selectElementWithMatcher:webViewMatcher] | |
| 77 assertWithMatcher:grey_nil()]; | |
| 78 NSString* const kError = | 72 NSString* const kError = |
| 79 l10n_util::GetNSString(IDS_ERRORPAGES_HEADING_NOT_AVAILABLE); | 73 l10n_util::GetNSString(IDS_ERRORPAGES_HEADING_NOT_AVAILABLE); |
| 80 [[EarlGrey | 74 [[EarlGrey |
| 81 selectElementWithMatcher:chrome_test_util::StaticHtmlViewContainingText( | 75 selectElementWithMatcher:chrome_test_util::StaticHtmlViewContainingText( |
| 82 kError)] assertWithMatcher:grey_notNil()]; | 76 kError)] assertWithMatcher:grey_notNil()]; |
| 83 | 77 |
| 84 // Execute the Print action. | 78 // Execute the Print action. |
| 85 [[EarlGrey selectElementWithMatcher:PrintButton()] performAction:grey_tap()]; | 79 [[EarlGrey selectElementWithMatcher:PrintButton()] performAction:grey_tap()]; |
| 86 | 80 |
| 87 // Verify that a toast notification appears. | 81 // Verify that a toast notification appears. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 assertWithMatcher:grey_interactable()]; | 134 assertWithMatcher:grey_interactable()]; |
| 141 | 135 |
| 142 // Start the Copy action and verify that the share menu gets dismissed. | 136 // Start the Copy action and verify that the share menu gets dismissed. |
| 143 [[EarlGrey | 137 [[EarlGrey |
| 144 selectElementWithMatcher:chrome_test_util::ButtonWithAccessibilityLabel( | 138 selectElementWithMatcher:chrome_test_util::ButtonWithAccessibilityLabel( |
| 145 @"Copy")] performAction:grey_tap()]; | 139 @"Copy")] performAction:grey_tap()]; |
| 146 AssertActivityServiceNotVisible(); | 140 AssertActivityServiceNotVisible(); |
| 147 } | 141 } |
| 148 | 142 |
| 149 @end | 143 @end |
| OLD | NEW |