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 dacefd0563fc1d7a626a87ba508f3b66d34069dd..09bec48e1ba4c7ebd8eb2b51c30d416cebbefa4a 100644 |
--- a/chrome/test/data/webui/print_preview.js |
+++ b/chrome/test/data/webui/print_preview.js |
@@ -68,6 +68,7 @@ PrintPreviewWebUITest.prototype = { |
disableColorOption: true, |
setColorAsDefault: true, |
disableCopiesOption: true, |
+ printerDefaultDuplexValue: copiesSettings.SIMPLEX, |
}); |
})); |
var savedArgs = new SaveMockArguments(); |
@@ -298,6 +299,7 @@ TEST_F('PrintPreviewWebUITest', 'TestSectionsDisabled', function() { |
setColorAsDefault: true, |
disableCopiesOption: true, |
disableLandscapeOption: true, |
+ printerDefaultDuplexValue: copiesSettings.SIMPLEX, |
}); |
})); |
@@ -317,6 +319,7 @@ TEST_F('PrintPreviewWebUITest', 'TestColorSettings', function() { |
setColorAsDefault: true, |
disableCopiesOption: false, |
disableLandscapeOption: false, |
+ printerDefaultDuplexValue: copiesSettings.SIMPLEX, |
}); |
})); |
@@ -331,6 +334,7 @@ TEST_F('PrintPreviewWebUITest', 'TestColorSettings', function() { |
setColorAsDefault: false, |
disableCopiesOption: false, |
disableLandscapeOption: false, |
+ printerDefaultDuplexValue: copiesSettings.SIMPLEX, |
}); |
})); |
@@ -339,6 +343,56 @@ TEST_F('PrintPreviewWebUITest', 'TestColorSettings', function() { |
expectTrue(colorSettings.bwRadioButton.checked); |
}); |
+// Test to verify that duplex settings are set according to the printer |
+// capabilities. |
+TEST_F('PrintPreviewWebUITest', 'TestDuplexSettings', function() { |
+ this.mockHandler.expects(once()).getPrinterCapabilities('FooDevice'). |
+ will(callFunction(function() { |
+ updateWithPrinterCapabilities({ |
+ disableColorOption: false, |
+ setColorAsDefault: false, |
+ disableCopiesOption: false, |
+ disableLandscapeOption: false, |
+ printerDefaultDuplexValue: copiesSettings.SIMPLEX, |
+ }); |
+ })); |
+ updateControlsWithSelectedPrinterCapabilities(); |
+ expectEquals(copiesSettings.duplexMode, copiesSettings.SIMPLEX); |
+ expectEquals(copiesSettings.twoSidedOption_.hidden, false); |
+ |
+ // If the printer default duplex value is UNKNOWN_DUPLEX_MODE, hide the |
+ // two sided option. |
+ this.mockHandler.expects(once()).getPrinterCapabilities('FooDevice'). |
+ will(callFunction(function() { |
+ updateWithPrinterCapabilities({ |
+ disableColorOption: false, |
+ setColorAsDefault: false, |
+ disableCopiesOption: false, |
+ disableLandscapeOption: false, |
+ printerDefaultDuplexValue: copiesSettings.UNKNOWN_DUPLEX_MODE, |
+ }); |
+ })); |
+ updateControlsWithSelectedPrinterCapabilities(); |
+ expectEquals(copiesSettings.duplexMode, copiesSettings.UNKNOWN_DUPLEX_MODE); |
+ expectEquals(copiesSettings.twoSidedOption_.hidden, true); |
+ |
+ this.mockHandler.expects(once()).getPrinterCapabilities('FooDevice'). |
+ will(callFunction(function() { |
+ updateWithPrinterCapabilities({ |
+ disableColorOption: false, |
+ setColorAsDefault: false, |
+ disableCopiesOption: false, |
+ disableLandscapeOption: false, |
+ printerDefaultDuplexValue: copiesSettings.SIMPLEX, |
+ }); |
+ })); |
+ updateControlsWithSelectedPrinterCapabilities(); |
+ expectEquals(copiesSettings.twoSidedOption_.hidden, false); |
+ expectEquals(copiesSettings.duplexMode, copiesSettings.SIMPLEX); |
+ copiesSettings.twoSidedCheckbox.checked = true; |
+ expectEquals(copiesSettings.duplexMode, copiesSettings.LONG_EDGE); |
+}); |
+ |
// Test that changing the selected printer updates the preview. |
TEST_F('PrintPreviewWebUITest', 'TestPrinterChangeUpdatesPreview', function() { |
var savedArgs = new SaveMockArguments(); |