Commit c61f25a1 authored by Peter K. Lee's avatar Peter K. Lee Committed by Commit Bot

No simple way to test "Print" action on Activity Services (Share) menu

PrintControllerTestCase tests are unconditionally disabled. I looked into
enabling them by rewriting them using XCUITest. It turned out that
XCUITestElements do not give access to the actions on the Activity
Services menu.

Deleting tests since they are not serving any purpose.

Bug: 990947
Change-Id: Ie17efff877e67ab2b1b3feb9e13bd9962e008976
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1894612Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Commit-Queue: Peter Lee <pkl@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711874}
parent 0b60f16a
......@@ -22,26 +22,3 @@ source_set("print") {
]
libs = [ "UIKit.framework" ]
}
source_set("eg_tests") {
configs += [ "//build/config/compiler:enable_arc" ]
testonly = true
sources = [
"print_controller_egtest.mm",
]
deps = [
"//ios/chrome/app/strings",
"//ios/chrome/browser/ui/util",
"//ios/chrome/test/app:test_support",
"//ios/chrome/test/earl_grey:test_support",
"//ios/testing/earl_grey:earl_grey_support",
"//ios/third_party/earl_grey:earl_grey+link",
"//ios/web/public/test/http_server",
"//ui/base",
"//url",
]
libs = [
"UIKit.framework",
"XCTest.framework",
]
}
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import <EarlGrey/EarlGrey.h>
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>
#include "base/ios/ios_util.h"
#import "ios/chrome/browser/ui/util/uikit_ui_util.h"
#include "ios/chrome/grit/ios_strings.h"
#import "ios/chrome/test/app/chrome_test_util.h"
#import "ios/chrome/test/earl_grey/chrome_earl_grey.h"
#import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h"
#import "ios/chrome/test/earl_grey/chrome_matchers.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#include "ios/testing/earl_grey/disabled_test_macros.h"
#import "ios/web/public/test/http_server/http_server.h"
#include "ios/web/public/test/http_server/http_server_util.h"
#include "ui/base/l10n/l10n_util_mac.h"
#include "url/gurl.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace {
// URL which leads to a PDF file.
const char kPDFURL[] = "http://ios/testing/data/http_server_files/testpage.pdf";
// A test HTML URL.
const char kHTMLURL[] = "http://test";
} // namespace
// Print test cases. These are Earl Grey integration tests.
// They test printing a normal page and a pdf.
@interface PrintControllerTestCase : ChromeTestCase
// Tests that it is possible to print the current page by opening the sharing
// menu, tapping on print and verifying it displays the print page.
- (void)printCurrentPage;
@end
@implementation PrintControllerTestCase
// Tests that the AirPrint menu successfully loads when a normal web page is
// loaded.
// TODO(crbug.com/683280): Does this test serve any purpose on iOS11?
- (void)testPrintNormalPage {
// TODO(crbug.com/990947): Delete or enable the test.
EARL_GREY_TEST_DISABLED(@"Dispatcher-based printing does not work.");
GURL url = web::test::HttpServer::MakeUrl(kHTMLURL);
std::map<GURL, std::string> responses;
std::string response = "Test";
responses[url] = response;
web::test::SetUpSimpleHttpServer(responses);
[ChromeEarlGrey loadURL:url];
[ChromeEarlGrey waitForWebStateContainingText:response];
[self printCurrentPage];
}
// Tests that the AirPrint menu successfully loads when a PDF is loaded.
// TODO(crbug.com/683280): Does this test serve any purpose on iOS11?
- (void)testPrintPDF {
// TODO(crbug.com/990947): Delete or enable the test.
EARL_GREY_TEST_DISABLED(@"Dispatcher-based printing does not work.");
web::test::SetUpFileBasedHttpServer();
GURL url = web::test::HttpServer::MakeUrl(kPDFURL);
[ChromeEarlGrey loadURL:url waitForCompletion:NO];
[self printCurrentPage];
}
- (void)printCurrentPage {
id<GREYMatcher> printerOptionButton = grey_allOf(
grey_accessibilityID(@"Printer Options"),
grey_not(grey_accessibilityTrait(UIAccessibilityTraitHeader)), nil);
[[EarlGrey selectElementWithMatcher:printerOptionButton]
assertWithMatcher:grey_sufficientlyVisible()];
}
@end
......@@ -90,7 +90,6 @@ chrome_ios_eg_test("ios_chrome_ui_egtests") {
"//ios/chrome/browser/ui/omnibox/popup/shortcuts:eg_tests",
"//ios/chrome/browser/ui/page_info:eg_tests",
"//ios/chrome/browser/ui/popup_menu:eg_tests",
"//ios/chrome/browser/ui/print:eg_tests",
"//ios/chrome/browser/ui/qr_scanner:eg_tests",
"//ios/chrome/browser/ui/recent_tabs:eg_tests",
"//ios/chrome/browser/ui/sad_tab:eg_tests",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment