| Index: chrome/test/data/webui/print_preview/print_preview.js
|
| diff --git a/chrome/test/data/webui/print_preview/print_preview.js b/chrome/test/data/webui/print_preview/print_preview.js
|
| index 3986fbabccbae5c856f6e3819c5e1ceaac3983e7..fbc893c79c1c5f034ebc1e9df5c210ded2586f6c 100644
|
| --- a/chrome/test/data/webui/print_preview/print_preview.js
|
| +++ b/chrome/test/data/webui/print_preview/print_preview.js
|
| @@ -296,378 +296,6 @@ function isPrintAsImageEnabled() {
|
| }
|
|
|
|
|
| -TEST_F('PrintPreviewWebUITest', 'TestSystemDialogLinkIsHiddenInAppKioskMode',
|
| - function() {
|
| - if (!cr.isChromeOS)
|
| - this.initialSettings_.isInAppKioskMode_ = true;
|
| -
|
| - this.setInitialSettings();
|
| - this.nativeLayer_.whenCalled('getInitialSettings').then(
|
| - function() {
|
| - if (cr.isChromeOS)
|
| - assertEquals(null, $('system-dialog-link'));
|
| - else
|
| - checkElementDisplayed($('system-dialog-link'), false);
|
| - testDone();
|
| - });
|
| -});
|
| -
|
| -// Test that disabled settings hide the disabled sections.
|
| -TEST_F('PrintPreviewWebUITest', 'TestSectionsDisabled', function() {
|
| - this.createPrintPreview();
|
| - checkSectionVisible($('layout-settings'), false);
|
| - checkSectionVisible($('color-settings'), false);
|
| - checkSectionVisible($('copies-settings'), false);
|
| -
|
| - this.setInitialSettings();
|
| - this.nativeLayer_.whenCalled('getInitialSettings').then(
|
| - function() {
|
| - this.setLocalDestinations();
|
| - var device = getCddTemplate("FooDevice");
|
| - device.capabilities.printer.color = {
|
| - "option": [
|
| - {"is_default": true, "type": "STANDARD_COLOR"}
|
| - ]
|
| - };
|
| - delete device.capabilities.printer.copies;
|
| - this.setCapabilities(device);
|
| -
|
| - checkSectionVisible($('layout-settings'), true);
|
| - checkSectionVisible($('color-settings'), false);
|
| - checkSectionVisible($('copies-settings'), false);
|
| -
|
| - this.waitForAnimationToEnd('other-options-collapsible');
|
| - }.bind(this));
|
| -});
|
| -
|
| -// When the source is 'PDF' and 'Save as PDF' option is selected, we hide the
|
| -// fit to page option.
|
| -TEST_F('PrintPreviewWebUITest', 'PrintToPDFSelectedCapabilities', function() {
|
| - // Add PDF printer.
|
| - this.initialSettings_.isDocumentModifiable_ = false;
|
| - this.initialSettings_.systemDefaultDestinationId_ = 'Save as PDF';
|
| - this.setInitialSettings();
|
| -
|
| - this.nativeLayer_.whenCalled('getInitialSettings').then(
|
| - function() {
|
| - var device = {
|
| - printerId: 'Save as PDF',
|
| - capabilities: {
|
| - version: '1.0',
|
| - printer: {
|
| - page_orientation: {
|
| - option: [
|
| - {type: 'AUTO', is_default: true},
|
| - {type: 'PORTRAIT'},
|
| - {type: 'LANDSCAPE'}
|
| - ]
|
| - },
|
| - color: {
|
| - option: [
|
| - {type: 'STANDARD_COLOR', is_default: true}
|
| - ]
|
| - },
|
| - media_size: {
|
| - option: [
|
| - { name: 'NA_LETTER',
|
| - width_microns: 0,
|
| - height_microns: 0,
|
| - is_default: true
|
| - }
|
| - ]
|
| - }
|
| - }
|
| - }
|
| - };
|
| - this.setCapabilities(device);
|
| -
|
| - 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, isPrintAsImageEnabled());
|
| - if (isPrintAsImageEnabled()) {
|
| - checkElementDisplayed(
|
| - otherOptions.querySelector('#fit-to-page-container'), false);
|
| - checkElementDisplayed(
|
| - otherOptions.querySelector('#rasterize-container'), true);
|
| - }
|
| - checkSectionVisible($('media-size-settings'), false);
|
| - checkSectionVisible($('scaling-settings'), false);
|
| -
|
| - testDone();
|
| - }.bind(this));
|
| -});
|
| -
|
| -// When the source is 'HTML', we always hide the fit to page option and show
|
| -// media size option.
|
| -TEST_F('PrintPreviewWebUITest', 'SourceIsHTMLCapabilities', function() {
|
| - this.setInitialSettings();
|
| - this.nativeLayer_.whenCalled('getInitialSettings').then(
|
| - function() {
|
| - this.setLocalDestinations();
|
| - this.setCapabilities(getCddTemplate("FooDevice"));
|
| -
|
| - var otherOptions = $('other-options-settings');
|
| - var fitToPage = otherOptions.querySelector('#fit-to-page-container');
|
| - var rasterize;
|
| - if (isPrintAsImageEnabled())
|
| - rasterize = otherOptions.querySelector('#rasterize-container');
|
| - var mediaSize = $('media-size-settings');
|
| - var scalingSettings = $('scaling-settings');
|
| -
|
| - // Check that options are collapsed (section is visible, because duplex
|
| - // is available).
|
| - checkSectionVisible(otherOptions, true);
|
| - checkElementDisplayed(fitToPage, false);
|
| - if (isPrintAsImageEnabled())
|
| - checkElementDisplayed(rasterize, false);
|
| - checkSectionVisible(mediaSize, false);
|
| - checkSectionVisible(scalingSettings, false);
|
| -
|
| - this.expandMoreSettings();
|
| -
|
| - checkElementDisplayed(fitToPage, false);
|
| - if (isPrintAsImageEnabled())
|
| - checkElementDisplayed(rasterize, false);
|
| - checkSectionVisible(mediaSize, true);
|
| - checkSectionVisible(scalingSettings, true);
|
| -
|
| - this.waitForAnimationToEnd('more-settings');
|
| - }.bind(this));
|
| -});
|
| -
|
| -// When the source is "PDF", depending on the selected destination printer, we
|
| -// show/hide the fit to page option and hide media size selection.
|
| -TEST_F('PrintPreviewWebUITest', 'SourceIsPDFCapabilities', function() {
|
| - this.initialSettings_.isDocumentModifiable_ = false;
|
| - this.setInitialSettings();
|
| - this.nativeLayer_.whenCalled('getInitialSettings').then(
|
| - function() {
|
| - this.setLocalDestinations();
|
| - this.setCapabilities(getCddTemplate("FooDevice"));
|
| -
|
| - var otherOptions = $('other-options-settings');
|
| - var scalingSettings = $('scaling-settings');
|
| - var fitToPageContainer =
|
| - otherOptions.querySelector('#fit-to-page-container');
|
| - var rasterizeContainer;
|
| - if (isPrintAsImageEnabled()) {
|
| - rasterizeContainer =
|
| - otherOptions.querySelector('#rasterize-container');
|
| - }
|
| -
|
| - checkSectionVisible(otherOptions, true);
|
| - checkElementDisplayed(fitToPageContainer, true);
|
| - if (isPrintAsImageEnabled())
|
| - checkElementDisplayed(rasterizeContainer, false);
|
| - expectTrue(
|
| - fitToPageContainer.querySelector('.checkbox').checked);
|
| - this.expandMoreSettings();
|
| - if (isPrintAsImageEnabled()) {
|
| - checkElementDisplayed(rasterizeContainer, true);
|
| - expectFalse(
|
| - rasterizeContainer.querySelector('.checkbox').checked);
|
| - }
|
| - checkSectionVisible($('media-size-settings'), true);
|
| - checkSectionVisible(scalingSettings, true);
|
| -
|
| - this.waitForAnimationToEnd('other-options-collapsible');
|
| - }.bind(this));
|
| -});
|
| -
|
| -// When the source is "PDF", depending on the selected destination printer, we
|
| -// show/hide the fit to page option and hide media size selection.
|
| -TEST_F('PrintPreviewWebUITest', 'ScalingUnchecksFitToPage', function() {
|
| - this.initialSettings_.isDocumentModifiable_ = false;
|
| - this.setInitialSettings();
|
| - this.nativeLayer_.whenCalled('getInitialSettings').then(
|
| - function() {
|
| - this.setLocalDestinations();
|
| - this.setCapabilities(getCddTemplate("FooDevice"));
|
| -
|
| - var otherOptions = $('other-options-settings');
|
| - var scalingSettings = $('scaling-settings');
|
| -
|
| - checkSectionVisible(otherOptions, true);
|
| - var fitToPageContainer =
|
| - otherOptions.querySelector('#fit-to-page-container');
|
| - checkElementDisplayed(fitToPageContainer, true);
|
| - expectTrue(
|
| - fitToPageContainer.querySelector('.checkbox').checked);
|
| - this.expandMoreSettings();
|
| - checkSectionVisible($('media-size-settings'), true);
|
| - checkSectionVisible(scalingSettings, true);
|
| -
|
| - // Change scaling input
|
| - var scalingInput = scalingSettings.querySelector('.user-value');
|
| - expectEquals('100', scalingInput.value);
|
| - scalingInput.stepUp(5);
|
| - expectEquals('105', scalingInput.value);
|
| -
|
| - // Trigger the event
|
| - var enterEvent = document.createEvent('Event');
|
| - enterEvent.initEvent('keydown');
|
| - enterEvent.keyCode = 'Enter';
|
| - scalingInput.dispatchEvent(enterEvent);
|
| - expectFalse(
|
| - fitToPageContainer.querySelector('.checkbox').checked);
|
| -
|
| - this.waitForAnimationToEnd('other-options-collapsible');
|
| - }.bind(this));
|
| -});
|
| -
|
| -// When the number of copies print preset is set for source 'PDF', we update
|
| -// the copies value if capability is supported by printer.
|
| -TEST_F('PrintPreviewWebUITest', 'CheckNumCopiesPrintPreset', function() {
|
| - this.initialSettings_.isDocumentModifiable_ = false;
|
| - this.setInitialSettings();
|
| - this.nativeLayer_.whenCalled('getInitialSettings').then(
|
| - function() {
|
| - 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_.getEventTarget().
|
| - dispatchEvent(printPresetOptionsEvent);
|
| -
|
| - checkSectionVisible($('copies-settings'), true);
|
| - expectEquals(
|
| - printPresetOptions.copies,
|
| - parseInt($('copies-settings').querySelector('.user-value').value));
|
| -
|
| - this.waitForAnimationToEnd('other-options-collapsible');
|
| - }.bind(this));
|
| -});
|
| -
|
| -// When the duplex print preset is set for source 'PDF', we update the
|
| -// duplex setting if capability is supported by printer.
|
| -TEST_F('PrintPreviewWebUITest', 'CheckDuplexPrintPreset', function() {
|
| - this.initialSettings_.isDocumentModifiable_ = false;
|
| - this.setInitialSettings();
|
| -
|
| - this.nativeLayer_.whenCalled('getInitialSettings').then(
|
| - function() {
|
| - this.setLocalDestinations();
|
| - this.setCapabilities(getCddTemplate("FooDevice"));
|
| -
|
| - // Indicate that the duplex print preset is set to "long edge" for
|
| - // source PDF.
|
| - var printPresetOptions = {
|
| - duplex: 1
|
| - };
|
| - var printPresetOptionsEvent = new Event(
|
| - print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS);
|
| - printPresetOptionsEvent.optionsFromDocument = printPresetOptions;
|
| - this.nativeLayer_.getEventTarget().
|
| - dispatchEvent(printPresetOptionsEvent);
|
| -
|
| - var otherOptions = $('other-options-settings');
|
| - checkSectionVisible(otherOptions, true);
|
| - var duplexContainer = otherOptions.querySelector('#duplex-container');
|
| - checkElementDisplayed(duplexContainer, true);
|
| - expectTrue(duplexContainer.querySelector('.checkbox').checked);
|
| -
|
| - this.waitForAnimationToEnd('other-options-collapsible');
|
| - }.bind(this));
|
| -});
|
| -
|
| -// Make sure that custom margins controls are properly set up.
|
| -TEST_F('PrintPreviewWebUITest', 'CustomMarginsControlsCheck', function() {
|
| - this.setInitialSettings();
|
| - this.nativeLayer_.whenCalled('getInitialSettings').then(
|
| - function() {
|
| - this.setLocalDestinations();
|
| - this.setCapabilities(getCddTemplate("FooDevice"));
|
| -
|
| - this.printPreview_.printTicketStore_.marginsType.updateValue(
|
| - print_preview.ticket_items.MarginsTypeValue.CUSTOM);
|
| -
|
| - ['left', 'top', 'right', 'bottom'].forEach(function(margin) {
|
| - var control =
|
| - $('preview-area').querySelector('.margin-control-' + margin);
|
| - assertNotEquals(null, control);
|
| - var input = control.querySelector('.margin-control-textbox');
|
| - assertTrue(input.hasAttribute('aria-label'));
|
| - assertNotEquals('undefined', input.getAttribute('aria-label'));
|
| - });
|
| - this.waitForAnimationToEnd('more-settings');
|
| - }.bind(this));
|
| -});
|
| -
|
| -// Page layout has zero margins. Hide header and footer option.
|
| -TEST_F('PrintPreviewWebUITest', 'PageLayoutHasNoMarginsHideHeaderFooter',
|
| - function() {
|
| - this.setInitialSettings();
|
| - this.nativeLayer_.whenCalled('getInitialSettings').then(
|
| - function() {
|
| - this.setLocalDestinations();
|
| - this.setCapabilities(getCddTemplate("FooDevice"));
|
| -
|
| - var otherOptions = $('other-options-settings');
|
| - var headerFooter =
|
| - otherOptions.querySelector('#header-footer-container');
|
| -
|
| - // Check that options are collapsed (section is visible, because duplex
|
| - // is available).
|
| - checkSectionVisible(otherOptions, true);
|
| - checkElementDisplayed(headerFooter, false);
|
| -
|
| - this.expandMoreSettings();
|
| -
|
| - checkElementDisplayed(headerFooter, true);
|
| -
|
| - this.printPreview_.printTicketStore_.marginsType.updateValue(
|
| - print_preview.ticket_items.MarginsTypeValue.CUSTOM);
|
| - this.printPreview_.printTicketStore_.customMargins.updateValue(
|
| - new print_preview.Margins(0, 0, 0, 0));
|
| -
|
| - checkElementDisplayed(headerFooter, false);
|
| -
|
| - this.waitForAnimationToEnd('more-settings');
|
| - }.bind(this));
|
| -});
|
| -
|
| -// Page layout has half-inch margins. Show header and footer option.
|
| -TEST_F('PrintPreviewWebUITest', 'PageLayoutHasMarginsShowHeaderFooter',
|
| - function() {
|
| - this.setInitialSettings();
|
| - this.nativeLayer_.whenCalled('getInitialSettings').then(
|
| - function() {
|
| - this.setLocalDestinations();
|
| - this.setCapabilities(getCddTemplate("FooDevice"));
|
| -
|
| - var otherOptions = $('other-options-settings');
|
| - var headerFooter =
|
| - otherOptions.querySelector('#header-footer-container');
|
| -
|
| - // Check that options are collapsed (section is visible, because duplex
|
| - // is available).
|
| - checkSectionVisible(otherOptions, true);
|
| - checkElementDisplayed(headerFooter, false);
|
| -
|
| - this.expandMoreSettings();
|
| -
|
| - checkElementDisplayed(headerFooter, true);
|
| -
|
| - this.printPreview_.printTicketStore_.marginsType.updateValue(
|
| - print_preview.ticket_items.MarginsTypeValue.CUSTOM);
|
| - this.printPreview_.printTicketStore_.customMargins.updateValue(
|
| - new print_preview.Margins(36, 36, 36, 36));
|
| -
|
| - checkElementDisplayed(headerFooter, true);
|
| -
|
| - this.waitForAnimationToEnd('more-settings');
|
| - }.bind(this));
|
| -});
|
| -
|
| // Page layout has zero top and bottom margins. Hide header and footer option.
|
| TEST_F('PrintPreviewWebUITest',
|
| 'ZeroTopAndBottomMarginsHideHeaderFooter',
|
|
|