| 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 #import <XCTest/XCTest.h> | 6 #import <XCTest/XCTest.h> |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" | 9 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" |
| 10 #import "ios/chrome/test/earl_grey/chrome_matchers.h" | 10 #import "ios/chrome/test/earl_grey/chrome_matchers.h" |
| 11 #import "ios/chrome/test/earl_grey/chrome_test_case.h" | 11 #import "ios/chrome/test/earl_grey/chrome_test_case.h" |
| 12 #import "ios/web/public/test/http_server.h" | 12 #import "ios/web/public/test/http_server.h" |
| 13 #import "ios/web/public/test/http_server_util.h" | 13 #import "ios/web/public/test/http_server_util.h" |
| 14 | 14 |
| 15 using chrome_test_util::webViewContainingText; | |
| 16 | |
| 17 // Test case for bringing up the print dialog when a web site's JavaScript runs | 15 // Test case for bringing up the print dialog when a web site's JavaScript runs |
| 18 // "window.print". | 16 // "window.print". |
| 19 @interface JSPrintTestCase : ChromeTestCase | 17 @interface JSPrintTestCase : ChromeTestCase |
| 20 @end | 18 @end |
| 21 | 19 |
| 22 @implementation JSPrintTestCase | 20 @implementation JSPrintTestCase |
| 23 | 21 |
| 24 // Tests that tapping a button with onclick='window.print' brings up the | 22 // Tests that tapping a button with onclick='window.print' brings up the |
| 25 // print dialog. | 23 // print dialog. |
| 26 - (void)testWebPrintButton { | 24 - (void)testWebPrintButton { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 47 assertWithMatcher:grey_sufficientlyVisible()]; | 45 assertWithMatcher:grey_sufficientlyVisible()]; |
| 48 | 46 |
| 49 // Clean up and close print dialog. | 47 // Clean up and close print dialog. |
| 50 id<GREYMatcher> cancelButton = | 48 id<GREYMatcher> cancelButton = |
| 51 grey_allOf(grey_accessibilityLabel(@"Cancel"), | 49 grey_allOf(grey_accessibilityLabel(@"Cancel"), |
| 52 grey_accessibilityTrait(UIAccessibilityTraitButton), nil); | 50 grey_accessibilityTrait(UIAccessibilityTraitButton), nil); |
| 53 [[EarlGrey selectElementWithMatcher:cancelButton] performAction:grey_tap()]; | 51 [[EarlGrey selectElementWithMatcher:cancelButton] performAction:grey_tap()]; |
| 54 } | 52 } |
| 55 | 53 |
| 56 @end | 54 @end |
| OLD | NEW |