Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1598)

Unified Diff: chrome/test/data/webui/print_preview.js

Issue 7817013: PrintPreview: Added code to identify the printer default duplex value. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed dpapad@ comments. Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/print_preview_handler.cc ('k') | printing/print_job_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « chrome/browser/ui/webui/print_preview_handler.cc ('k') | printing/print_job_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698