Commit 66a63dc5 authored by Findit's avatar Findit

Revert "Print Preview Refresh: Enable change button while destination loads"

This reverts commit 9f695d72.

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}
parent 78e17bee
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
<link rel="import" href="print_preview_shared_css.html"> <link rel="import" href="print_preview_shared_css.html">
<link rel="import" href="throbber_css.html"> <link rel="import" href="throbber_css.html">
<link rel="import" href="settings_section.html"> <link rel="import" href="settings_section.html">
<link rel="import" href="state.html">
<link rel="import" href="strings.html"> <link rel="import" href="strings.html">
<dom-module id="print-preview-destination-settings"> <dom-module id="print-preview-destination-settings">
......
...@@ -59,7 +59,7 @@ Polymer({ ...@@ -59,7 +59,7 @@ Polymer({
*/ */
shouldDisableButton_: function() { shouldDisableButton_: function() {
return !this.destinationStore || return !this.destinationStore ||
(this.disabled && this.state != print_preview_new.State.NOT_READY && (this.disabled &&
this.state != print_preview_new.State.INVALID_PRINTER); this.state != print_preview_new.State.INVALID_PRINTER);
}, },
......
// 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,
};
});
...@@ -1119,27 +1119,3 @@ TEST_F( ...@@ -1119,27 +1119,3 @@ TEST_F(
TEST_F('PrintPreviewKeyEventTest', 'CtrlShiftPOpensSystemDialog', function() { TEST_F('PrintPreviewKeyEventTest', 'CtrlShiftPOpensSystemDialog', function() {
this.runMochaTest(key_event_test.TestNames.CtrlShiftPOpensSystemDialog); 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);
});
...@@ -254,7 +254,6 @@ PrintPreviewDestinationDialogTest.* ...@@ -254,7 +254,6 @@ PrintPreviewDestinationDialogTest.*
PrintPreviewDestinationItemTest.* PrintPreviewDestinationItemTest.*
PrintPreviewDestinationListTest.* PrintPreviewDestinationListTest.*
PrintPreviewDestinationSearchTest.* PrintPreviewDestinationSearchTest.*
PrintPreviewDestinationSettingsTest.*
PrintPreviewHeaderTest.* PrintPreviewHeaderTest.*
PrintPreviewKeyEventTest.* PrintPreviewKeyEventTest.*
PrintPreviewLinkContainerTest.* PrintPreviewLinkContainerTest.*
......
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