Index: chrome/test/data/webui/print_preview.js |
diff --git a/chrome/test/data/webui/print_preview.js b/chrome/test/data/webui/print_preview.js |
index ad4993642aa75096850d916bc158a57b0ccae795..96199aa4ddc757a0848295400b88d3542b8bb138 100644 |
--- a/chrome/test/data/webui/print_preview.js |
+++ b/chrome/test/data/webui/print_preview.js |
@@ -474,8 +474,10 @@ TEST_F('PrintPreviewWebUITest', 'PrintScalingDisabledForPlugin', function() { |
this.setCapabilities(getCddTemplate("FooDevice")); |
// Indicate that the PDF does not support scaling by default. |
- cr.dispatchSimpleEvent( |
- this.nativeLayer_, print_preview.NativeLayer.EventType.DISABLE_SCALING); |
+ var printPresetOptionsEvent = new Event( |
+ print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS); |
+ printPresetOptionsEvent.optionsFromDocument = {disableScaling: true}; |
+ this.nativeLayer_.dispatchEvent(printPresetOptionsEvent); |
var otherOptions = $('other-options-settings'); |
checkSectionVisible(otherOptions, true); |
@@ -487,6 +489,32 @@ TEST_F('PrintPreviewWebUITest', 'PrintScalingDisabledForPlugin', function() { |
this.waitForAnimationToEnd('other-options-collapsible'); |
}); |
+// When the number of copies print preset is set for source 'PDF', we update |
+// copies value if capability is supported by printer. |
+TEST_F('PrintPreviewWebUITest', 'CheckNumCopiesPrintPreset', function() { |
+ this.initialSettings_.isDocumentModifiable_ = false; |
+ this.setInitialSettings(); |
+ this.setLocalDestinations(); |
+ this.setCapabilities(getCddTemplate("FooDevice")); |
+ |
+ // Indicate that the number of copies print preset is set for source PDF. |
+ var printPresetOptions = { |
+ disableScaling: true, |
+ copies: 2 |
+ }; |
+ var printPresetOptionsEvent = new Event( |
+ print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS); |
+ printPresetOptionsEvent.optionsFromDocument = printPresetOptions; |
+ this.nativeLayer_.dispatchEvent(printPresetOptionsEvent); |
+ |
+ checkSectionVisible($('copies-settings'), true); |
+ expectEquals( |
+ printPresetOptions.copies, |
+ parseInt($('copies-settings').querySelector('.copies').value)); |
+ |
+ this.waitForAnimationToEnd('other-options-collapsible'); |
+}); |
+ |
// Make sure that custom margins controls are properly set up. |
TEST_F('PrintPreviewWebUITest', 'CustomMarginsControlsCheck', function() { |
this.setInitialSettings(); |