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 3282b3451504617e88513df27b25607782444162..0bd3470887f23383a84b78cbaf794b81a47eeef7 100644 |
--- a/chrome/test/data/webui/print_preview.js |
+++ b/chrome/test/data/webui/print_preview.js |
@@ -375,6 +375,10 @@ function getCddTemplate(printerId) { |
}; |
} |
+function isPrintAsImageEnabled() { |
+ return !cr.isWindows && !cr.isMac; |
+} |
+ |
// Test restore settings with one destination. |
TEST_F('PrintPreviewWebUITest', 'TestPrintPreviewRestoreLocalDestination', |
function() { |
@@ -555,8 +559,8 @@ TEST_F('PrintPreviewWebUITest', 'PrintToPDFSelectedCapabilities', function() { |
var otherOptions = $('other-options-settings'); |
// If rasterization is an option, other options should be visible. If not, |
// there should be no available other options. |
- checkSectionVisible(otherOptions, !cr.isWindows && !cr.isMac); |
- if (!cr.isWindows && !cr.isMac) { |
+ checkSectionVisible(otherOptions, isPrintAsImageEnabled()); |
+ if (isPrintAsImageEnabled()) { |
checkElementDisplayed( |
otherOptions.querySelector('#fit-to-page-container'), false); |
checkElementDisplayed( |
@@ -578,8 +582,7 @@ TEST_F('PrintPreviewWebUITest', 'SourceIsHTMLCapabilities', function() { |
var otherOptions = $('other-options-settings'); |
var fitToPage = otherOptions.querySelector('#fit-to-page-container'); |
var rasterize; |
- var rasterizeEnabled = !cr.isWindows && !cr.isMac; |
- if (rasterizeEnabled) |
+ if (isPrintAsImageEnabled()) |
rasterize = otherOptions.querySelector('#rasterize-container'); |
var mediaSize = $('media-size-settings'); |
var scalingSettings = $('scaling-settings'); |
@@ -588,7 +591,7 @@ TEST_F('PrintPreviewWebUITest', 'SourceIsHTMLCapabilities', function() { |
// available). |
checkSectionVisible(otherOptions, true); |
checkElementDisplayed(fitToPage, false); |
- if (rasterizeEnabled) |
+ if (isPrintAsImageEnabled()) |
checkElementDisplayed(rasterize, false); |
checkSectionVisible(mediaSize, false); |
checkSectionVisible(scalingSettings, false); |
@@ -596,7 +599,7 @@ TEST_F('PrintPreviewWebUITest', 'SourceIsHTMLCapabilities', function() { |
this.expandMoreSettings(); |
checkElementDisplayed(fitToPage, false); |
- if (rasterizeEnabled) |
+ if (isPrintAsImageEnabled()) |
checkElementDisplayed(rasterize, false); |
checkSectionVisible(mediaSize, true); |
checkSectionVisible(scalingSettings, true); |
@@ -616,21 +619,20 @@ TEST_F('PrintPreviewWebUITest', 'SourceIsPDFCapabilities', function() { |
var scalingSettings = $('scaling-settings'); |
var fitToPageContainer = |
otherOptions.querySelector('#fit-to-page-container'); |
- var rasterizeEnabled = !cr.isWindows && !cr.isMac; |
var rasterizeContainer; |
- if (rasterizeEnabled) { |
+ if (isPrintAsImageEnabled()) { |
rasterizeContainer = |
otherOptions.querySelector('#rasterize-container'); |
} |
checkSectionVisible(otherOptions, true); |
checkElementDisplayed(fitToPageContainer, true); |
- if (rasterizeEnabled) |
+ if (isPrintAsImageEnabled()) |
checkElementDisplayed(rasterizeContainer, false); |
expectTrue( |
fitToPageContainer.querySelector('.checkbox').checked); |
this.expandMoreSettings(); |
- if (rasterizeEnabled) { |
+ if (isPrintAsImageEnabled()) { |
checkElementDisplayed(rasterizeContainer, true); |
expectFalse( |
rasterizeContainer.querySelector('.checkbox').checked); |