Revert "Print Preview Refresh: Enable change button while destination loads"
This reverts commit 9f695d7249c926ddde8515ce5e7bf8505addecc3.
Reason for revert:
Findit (https://goo.gl/kROfz5) identified CL at revision 607896 as the
culprit for flakes in the build cycles as shown on:
https://findit-for-me.appspot.com/waterfall/flake/flake-culprit?key=ag9zfmZpbmRpdC1mb3ItbWVyQwsSDEZsYWtlQ3VscHJpdCIxY2hyb21pdW0vOWY2OTVkNzI0OWM5MjZkZGRlODUxNWNlNWU3YmY4NTA1YWRkZWNjMww
Sample Failed Build: https://ci.chromium.org/buildbot/chromium.linux/Linux%20Tests%20%28dbg%29%281%29%2832%29/54191
Sample Failed Step: browser_tests
Sample Flaky Test: PrintPreviewDestinationSettingsTest.ChangeButtonState
Original change's description:
> Print Preview Refresh: Enable change button while destination loads
>
> In some cases (e.g. kiosk apps with no default printer configured), the
> print destination may never load. Enable the "Change" button while
> destination capabilities are loading so that the user can switch
> destinations in this case.
>
> Bug: 901115
> Change-Id: I53eec9332e0d7f075e461226290d408ae6d6ef49
> Reviewed-on: https://chromium-review.googlesource.com/c/1332703
> Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
> Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
> Reviewed-by: Lei Zhang <thestig@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#607896}
Change-Id: I67b37b31938b6af5c19edc09a1e66b9019d0e198
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 901115, 905205
Reviewed-on: https://chromium-review.googlesource.com/c/1335278
Cr-Commit-Position: refs/heads/master@{#607919}
diff --git a/chrome/browser/resources/print_preview/new/destination_settings.html b/chrome/browser/resources/print_preview/new/destination_settings.html
index 8200b9d..a7302ad 100644
--- a/chrome/browser/resources/print_preview/new/destination_settings.html
+++ b/chrome/browser/resources/print_preview/new/destination_settings.html
@@ -17,7 +17,6 @@
<link rel="import" href="print_preview_shared_css.html">
<link rel="import" href="throbber_css.html">
<link rel="import" href="settings_section.html">
-<link rel="import" href="state.html">
<link rel="import" href="strings.html">
<dom-module id="print-preview-destination-settings">
diff --git a/chrome/browser/resources/print_preview/new/destination_settings.js b/chrome/browser/resources/print_preview/new/destination_settings.js
index 0fb6bd5..e16574bf 100644
--- a/chrome/browser/resources/print_preview/new/destination_settings.js
+++ b/chrome/browser/resources/print_preview/new/destination_settings.js
@@ -59,7 +59,7 @@
*/
shouldDisableButton_: function() {
return !this.destinationStore ||
- (this.disabled && this.state != print_preview_new.State.NOT_READY &&
+ (this.disabled &&
this.state != print_preview_new.State.INVALID_PRINTER);
},
diff --git a/chrome/test/data/webui/print_preview/destination_settings_test.js b/chrome/test/data/webui/print_preview/destination_settings_test.js
deleted file mode 100644
index 36e76d56..0000000
--- a/chrome/test/data/webui/print_preview/destination_settings_test.js
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2018 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.
-
-cr.define('destination_settings_test', function() {
- /** @enum {string} */
- const TestNames = {
- ChangeButtonState: 'change button state',
- };
-
- const suiteName = 'DestinationSettingsTest';
- suite(suiteName, function() {
- /** @type {?PrintPreviewDestinationSettingsElement} */
- let destinationSettings = null;
-
- /** @override */
- setup(function() {
- PolymerTest.clearBody();
- destinationSettings =
- document.createElement('print-preview-destination-settings');
- destinationSettings.disabled = false;
- destinationSettings.destinationStore = null;
- destinationSettings.state = print_preview_new.State.NOT_READY;
- document.body.appendChild(destinationSettings);
- });
-
- // Tests that the change button is enabled or disabled correctly based on
- // the state.
- test(assert(TestNames.ChangeButtonState), function() {
- const button = destinationSettings.$$('paper-button');
- // Initial state: No destination store, button should be disabled.
- assertTrue(button.disabled);
-
- // Set up the destination store, but no destination yet. Button is now
- // enabled.
- const userInfo = new print_preview.UserInfo();
- const destinationStore = new print_preview.DestinationStore(
- userInfo, new WebUIListenerTracker());
- destinationStore.init(
- false /* isInAppKioskMode */, 'FooDevice' /* printerName */,
- '' /* serializedDefaultDestinationSelectionRulesStr */,
- [] /* recentDestinations */);
- destinationSettings.destinationStore = destinationStore;
- destinationSettings.state = print_preview_new.State.NOT_READY;
- assertFalse(button.disabled);
-
- // Simulate loading a destination and setting state to ready. The button
- // is still enabled.
- destinationSettings.destination = new print_preview.Destination(
- 'FooDevice', print_preview.DestinationType.LOCAL,
- print_preview.DestinationOrigin.LOCAL, 'FooName', true /* isRecent */,
- print_preview.DestinationConnectionStatus.ONLINE);
- destinationSettings.state = print_preview_new.State.READY;
- assertFalse(button.disabled);
-
- // Simulate setting a setting to an invalid value. Button is disabled due
- // to validation error on another control.
- destinationSettings.state = print_preview_new.State.INVALID_TICKET;
- destinationSettings.disabled = true;
- assertTrue(button.disabled);
-
- // Simulate the user fixing the validation error, and then selecting an
- // invalid printer. Button is enabled, so that the user can fix the error.
- destinationSettings.state = print_preview_new.State.READY;
- destinationSettings.disabled = false;
- destinationSettings.state = print_preview_new.State.INVALID_PRINTER;
- destinationSettings.disabled = true;
- assertFalse(button.disabled);
- });
- });
-
- return {
- suiteName: suiteName,
- TestNames: TestNames,
- };
-});
diff --git a/chrome/test/data/webui/print_preview/new_print_preview_ui_browsertest.js b/chrome/test/data/webui/print_preview/new_print_preview_ui_browsertest.js
index 93def203..1b5fd5c 100644
--- a/chrome/test/data/webui/print_preview/new_print_preview_ui_browsertest.js
+++ b/chrome/test/data/webui/print_preview/new_print_preview_ui_browsertest.js
@@ -1119,27 +1119,3 @@
TEST_F('PrintPreviewKeyEventTest', 'CtrlShiftPOpensSystemDialog', function() {
this.runMochaTest(key_event_test.TestNames.CtrlShiftPOpensSystemDialog);
});
-
-PrintPreviewDestinationSettingsTest = class extends NewPrintPreviewTest {
- /** @override */
- get browsePreload() {
- return 'chrome://print/new/destination_settings.html';
- }
-
- /** @override */
- get extraLibraries() {
- return super.extraLibraries.concat([
- ROOT_PATH + 'ui/webui/resources/js/webui_listener_tracker.js',
- 'destination_settings_test.js',
- ]);
- }
-
- /** @override */
- get suiteName() {
- return destination_settings_test.suiteName;
- }
-};
-
-TEST_F('PrintPreviewDestinationSettingsTest', 'ChangeButtonState', function() {
- this.runMochaTest(destination_settings_test.TestNames.ChangeButtonState);
-});
diff --git a/testing/buildbot/filters/webui_polymer2_browser_tests.filter b/testing/buildbot/filters/webui_polymer2_browser_tests.filter
index d2038de..df76d2d 100644
--- a/testing/buildbot/filters/webui_polymer2_browser_tests.filter
+++ b/testing/buildbot/filters/webui_polymer2_browser_tests.filter
@@ -254,7 +254,6 @@
PrintPreviewDestinationItemTest.*
PrintPreviewDestinationListTest.*
PrintPreviewDestinationSearchTest.*
-PrintPreviewDestinationSettingsTest.*
PrintPreviewHeaderTest.*
PrintPreviewKeyEventTest.*
PrintPreviewLinkContainerTest.*