Commit cde6d580 authored by rbpotter's avatar rbpotter Committed by Commit Bot

Print Preview: Remove workaround for blink bug

crbug.com/804047 has been fixed, and the DCHECK referenced in the
Print Preview JS no longer occurs. Remove the async(..., 1) workaround.

Bug: None
Change-Id: I0a8f38a697965e912265092d33ef7a2d0e58f85f
Reviewed-on: https://chromium-review.googlesource.com/c/1281912Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600146}
parent 3bf60675
...@@ -42,12 +42,7 @@ Polymer({ ...@@ -42,12 +42,7 @@ Polymer({
attached: function() { attached: function() {
this.metrics_.record(print_preview.Metrics.PrintSettingsUiBucket this.metrics_.record(print_preview.Metrics.PrintSettingsUiBucket
.ADVANCED_SETTINGS_DIALOG_SHOWN); .ADVANCED_SETTINGS_DIALOG_SHOWN);
// This async() call is a workaround to prevent a DCHECK - see
// https://crbug.com/804047.
// TODO(rbpotter): Remove after Polymer2 migration is complete.
this.async(() => {
this.$.dialog.showModal(); this.$.dialog.showModal();
}, 1);
}, },
/** /**
......
...@@ -87,12 +87,7 @@ Polymer({ ...@@ -87,12 +87,7 @@ Polymer({
this.destinationStore.startLoadAllDestinations(); this.destinationStore.startLoadAllDestinations();
this.invitationStore.startLoadingInvitations(); this.invitationStore.startLoadingInvitations();
const dialog = this.$.destinationDialog.get(); const dialog = this.$.destinationDialog.get();
// This async() call is a workaround to prevent a DCHECK - see
// https://crbug.com/804047.
// TODO(rbpotter): Remove after Polymer2 migration is complete.
this.async(() => {
dialog.show(); dialog.show();
}, 1);
}, },
showCloudPrintPromo: function() { showCloudPrintPromo: function() {
......
...@@ -61,7 +61,7 @@ cr.define('advanced_dialog_test', function() { ...@@ -61,7 +61,7 @@ cr.define('advanced_dialog_test', function() {
dialog.destination = destination; dialog.destination = destination;
document.body.appendChild(dialog); document.body.appendChild(dialog);
return test_util.eventToPromise('cr-dialog-open', dialog); Polymer.dom.flush();
} }
/** /**
...@@ -99,20 +99,21 @@ cr.define('advanced_dialog_test', function() { ...@@ -99,20 +99,21 @@ cr.define('advanced_dialog_test', function() {
// Tests that the search box does not appear when there is only one option, // Tests that the search box does not appear when there is only one option,
// and that the vendor item is correctly displayed. // and that the vendor item is correctly displayed.
test(assert(TestNames.AdvancedSettings1Option), function() { test(assert(TestNames.AdvancedSettings1Option), function() {
return setupDialog(1).then(() => verifyListWithItemCount(1)); setupDialog(1);
verifyListWithItemCount(1);
}); });
// Tests that the search box appears when there are two options, and that // Tests that the search box appears when there are two options, and that
// the items are correctly displayed. // the items are correctly displayed.
test(assert(TestNames.AdvancedSettings2Options), function() { test(assert(TestNames.AdvancedSettings2Options), function() {
return setupDialog(2).then(() => verifyListWithItemCount(2)); setupDialog(2);
verifyListWithItemCount(2);
}); });
// Tests that the advanced settings dialog correctly updates the settings // Tests that the advanced settings dialog correctly updates the settings
// value for vendor items when the apply button is clicked. // value for vendor items when the apply button is clicked.
test(assert(TestNames.AdvancedSettingsApply), function() { test(assert(TestNames.AdvancedSettingsApply), function() {
return setupDialog(3) setupDialog(3);
.then(() => {
setItemValues(); setItemValues();
const buttons = dialog.shadowRoot.querySelectorAll('paper-button'); const buttons = dialog.shadowRoot.querySelectorAll('paper-button');
...@@ -121,9 +122,7 @@ cr.define('advanced_dialog_test', function() { ...@@ -121,9 +122,7 @@ cr.define('advanced_dialog_test', function() {
// Click apply button. // Click apply button.
buttons[1].click(); buttons[1].click();
return whenDialogClose; return whenDialogClose.then(() => {
})
.then(() => {
// Check that the setting has been set. // Check that the setting has been set.
const setting = dialog.getSettingValue('vendorItems'); const setting = dialog.getSettingValue('vendorItems');
assertEquals(6, setting.printArea); assertEquals(6, setting.printArea);
...@@ -135,8 +134,7 @@ cr.define('advanced_dialog_test', function() { ...@@ -135,8 +134,7 @@ cr.define('advanced_dialog_test', function() {
// Tests that the advanced settings dialog does not update the settings // Tests that the advanced settings dialog does not update the settings
// value for vendor items when the close button is clicked. // value for vendor items when the close button is clicked.
test(assert(TestNames.AdvancedSettingsClose), function() { test(assert(TestNames.AdvancedSettingsClose), function() {
return setupDialog(3) setupDialog(3);
.then(() => {
setItemValues(); setItemValues();
const buttons = dialog.shadowRoot.querySelectorAll('paper-button'); const buttons = dialog.shadowRoot.querySelectorAll('paper-button');
...@@ -145,9 +143,7 @@ cr.define('advanced_dialog_test', function() { ...@@ -145,9 +143,7 @@ cr.define('advanced_dialog_test', function() {
// Click close button. // Click close button.
buttons[0].click(); buttons[0].click();
return whenDialogClose; return whenDialogClose.then(() => {
})
.then(() => {
// Check that the setting has not been set. // Check that the setting has not been set.
const setting = dialog.getSettingValue('vendorItems'); const setting = dialog.getSettingValue('vendorItems');
assertEquals(undefined, setting.printArea); assertEquals(undefined, setting.printArea);
...@@ -159,7 +155,7 @@ cr.define('advanced_dialog_test', function() { ...@@ -159,7 +155,7 @@ cr.define('advanced_dialog_test', function() {
// Tests that the dialog correctly shows and hides settings based on the // Tests that the dialog correctly shows and hides settings based on the
// value of the search query. // value of the search query.
test(assert(TestNames.AdvancedSettingsFilter), function() { test(assert(TestNames.AdvancedSettingsFilter), function() {
return setupDialog(3).then(() => { setupDialog(3);
const searchBox = dialog.$.searchBox; const searchBox = dialog.$.searchBox;
const items = dialog.shadowRoot.querySelectorAll( const items = dialog.shadowRoot.querySelectorAll(
'print-preview-advanced-settings-item'); 'print-preview-advanced-settings-item');
...@@ -187,7 +183,6 @@ cr.define('advanced_dialog_test', function() { ...@@ -187,7 +183,6 @@ cr.define('advanced_dialog_test', function() {
assertFalse(noMatchHint.hidden); assertFalse(noMatchHint.hidden);
}); });
}); });
});
return { return {
suiteName: suiteName, suiteName: suiteName,
......
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