OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * Test fixture for print preview WebUI testing. | 6 * Test fixture for print preview WebUI testing. |
7 * @constructor | 7 * @constructor |
8 * @extends {testing.Test} | 8 * @extends {testing.Test} |
9 */ | 9 */ |
10 function PrintPreviewWebUITest() { | 10 function PrintPreviewWebUITest() { |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
467 | 467 |
468 // When the print scaling is disabled for the source "PDF", we show the fit | 468 // When the print scaling is disabled for the source "PDF", we show the fit |
469 // to page option but the state is unchecked by default. | 469 // to page option but the state is unchecked by default. |
470 TEST_F('PrintPreviewWebUITest', 'PrintScalingDisabledForPlugin', function() { | 470 TEST_F('PrintPreviewWebUITest', 'PrintScalingDisabledForPlugin', function() { |
471 this.initialSettings_.isDocumentModifiable_ = false; | 471 this.initialSettings_.isDocumentModifiable_ = false; |
472 this.setInitialSettings(); | 472 this.setInitialSettings(); |
473 this.setLocalDestinations(); | 473 this.setLocalDestinations(); |
474 this.setCapabilities(getCddTemplate("FooDevice")); | 474 this.setCapabilities(getCddTemplate("FooDevice")); |
475 | 475 |
476 // Indicate that the PDF does not support scaling by default. | 476 // Indicate that the PDF does not support scaling by default. |
477 cr.dispatchSimpleEvent( | 477 var printPresetOptions = {disableScaling: true}; |
478 this.nativeLayer_, print_preview.NativeLayer.EventType.DISABLE_SCALING); | 478 var printPresetOptionsEvent = new Event( |
479 print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS); | |
480 printPresetOptionsEvent.optionsFromDocument = printPresetOptions; | |
Aleksey Shlyapnikov
2014/12/04 18:45:57
Since you're not reusing them, inline them here:
Nikhil
2014/12/09 11:00:35
Done.
| |
481 this.nativeLayer_.dispatchEvent(printPresetOptionsEvent); | |
479 | 482 |
480 var otherOptions = $('other-options-settings'); | 483 var otherOptions = $('other-options-settings'); |
481 checkSectionVisible(otherOptions, true); | 484 checkSectionVisible(otherOptions, true); |
482 checkElementDisplayed( | 485 checkElementDisplayed( |
483 otherOptions.querySelector('.fit-to-page-container'), true); | 486 otherOptions.querySelector('.fit-to-page-container'), true); |
484 expectFalse( | 487 expectFalse( |
485 otherOptions.querySelector('.fit-to-page-checkbox').checked); | 488 otherOptions.querySelector('.fit-to-page-checkbox').checked); |
486 | 489 |
487 this.waitForAnimationToEnd('other-options-collapsible'); | 490 this.waitForAnimationToEnd('other-options-collapsible'); |
488 }); | 491 }); |
489 | 492 |
493 // When the number of copies print preset is set for source 'PDF', we update | |
494 // copies value if capability is supported by printer. | |
495 TEST_F('PrintPreviewWebUITest', 'CheckNumCopiesPrintPreset', function() { | |
496 this.initialSettings_.isDocumentModifiable_ = false; | |
497 this.setInitialSettings(); | |
498 this.setLocalDestinations(); | |
499 this.setCapabilities(getCddTemplate("FooDevice")); | |
500 | |
501 // Indicate that the number of copies print preset is set for source PDF. | |
502 var printPresetOptions = {disableScaling: true, copies: 2}; | |
Aleksey Shlyapnikov
2014/12/04 18:45:57
var printPresetOptions = {
disableScaling: true,
Nikhil
2014/12/09 11:00:35
Done.
| |
503 var printPresetOptionsEvent = new Event( | |
504 print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS); | |
505 printPresetOptionsEvent.optionsFromDocument = printPresetOptions; | |
506 this.nativeLayer_.dispatchEvent(printPresetOptionsEvent); | |
507 | |
508 checkSectionVisible($('copies-settings'), true); | |
509 expectEquals( | |
510 printPresetOptions.copies, | |
511 parseInt($('copies-settings').querySelector('.copies').value)); | |
512 | |
513 this.waitForAnimationToEnd('other-options-collapsible'); | |
514 }); | |
515 | |
490 // Make sure that custom margins controls are properly set up. | 516 // Make sure that custom margins controls are properly set up. |
491 TEST_F('PrintPreviewWebUITest', 'CustomMarginsControlsCheck', function() { | 517 TEST_F('PrintPreviewWebUITest', 'CustomMarginsControlsCheck', function() { |
492 this.setInitialSettings(); | 518 this.setInitialSettings(); |
493 this.setLocalDestinations(); | 519 this.setLocalDestinations(); |
494 this.setCapabilities(getCddTemplate("FooDevice")); | 520 this.setCapabilities(getCddTemplate("FooDevice")); |
495 | 521 |
496 printPreview.printTicketStore_.marginsType.updateValue( | 522 printPreview.printTicketStore_.marginsType.updateValue( |
497 print_preview.ticket_items.MarginsType.Value.CUSTOM); | 523 print_preview.ticket_items.MarginsType.Value.CUSTOM); |
498 | 524 |
499 ['left', 'top', 'right', 'bottom'].forEach(function(margin) { | 525 ['left', 'top', 'right', 'bottom'].forEach(function(margin) { |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
853 var printFailedMessageEl = | 879 var printFailedMessageEl = |
854 previewAreaEl.getElementsByClassName('preview-area-print-failed')[0]; | 880 previewAreaEl.getElementsByClassName('preview-area-print-failed')[0]; |
855 expectEquals(true, printFailedMessageEl.hidden); | 881 expectEquals(true, printFailedMessageEl.hidden); |
856 | 882 |
857 var customMessageEl = | 883 var customMessageEl = |
858 previewAreaEl.getElementsByClassName('preview-area-custom-message')[0]; | 884 previewAreaEl.getElementsByClassName('preview-area-custom-message')[0]; |
859 expectEquals(false, customMessageEl.hidden); | 885 expectEquals(false, customMessageEl.hidden); |
860 | 886 |
861 testDone(); | 887 testDone(); |
862 }); | 888 }); |
OLD | NEW |