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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 checkSectionVisible(otherOptions, true); | 493 checkSectionVisible(otherOptions, true); |
494 checkElementDisplayed( | 494 checkElementDisplayed( |
495 otherOptions.querySelector('.fit-to-page-container'), true); | 495 otherOptions.querySelector('.fit-to-page-container'), true); |
496 expectFalse( | 496 expectFalse( |
497 otherOptions.querySelector('.fit-to-page-checkbox').checked); | 497 otherOptions.querySelector('.fit-to-page-checkbox').checked); |
498 | 498 |
499 this.waitForAnimationToEnd('other-options-collapsible'); | 499 this.waitForAnimationToEnd('other-options-collapsible'); |
500 }); | 500 }); |
501 | 501 |
502 // When the number of copies print preset is set for source 'PDF', we update | 502 // When the number of copies print preset is set for source 'PDF', we update |
503 // copies value if capability is supported by printer. | 503 // the copies value if capability is supported by printer. |
504 TEST_F('PrintPreviewWebUITest', 'CheckNumCopiesPrintPreset', function() { | 504 TEST_F('PrintPreviewWebUITest', 'CheckNumCopiesPrintPreset', function() { |
505 this.initialSettings_.isDocumentModifiable_ = false; | 505 this.initialSettings_.isDocumentModifiable_ = false; |
506 this.setInitialSettings(); | 506 this.setInitialSettings(); |
507 this.setLocalDestinations(); | 507 this.setLocalDestinations(); |
508 this.setCapabilities(getCddTemplate("FooDevice")); | 508 this.setCapabilities(getCddTemplate("FooDevice")); |
509 | 509 |
510 // Indicate that the number of copies print preset is set for source PDF. | 510 // Indicate that the number of copies print preset is set for source PDF. |
511 var printPresetOptions = { | 511 var printPresetOptions = { |
512 disableScaling: true, | 512 disableScaling: true, |
513 copies: 2 | 513 copies: 2 |
514 }; | 514 }; |
515 var printPresetOptionsEvent = new Event( | 515 var printPresetOptionsEvent = new Event( |
516 print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS); | 516 print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS); |
517 printPresetOptionsEvent.optionsFromDocument = printPresetOptions; | 517 printPresetOptionsEvent.optionsFromDocument = printPresetOptions; |
518 this.nativeLayer_.dispatchEvent(printPresetOptionsEvent); | 518 this.nativeLayer_.dispatchEvent(printPresetOptionsEvent); |
519 | 519 |
520 checkSectionVisible($('copies-settings'), true); | 520 checkSectionVisible($('copies-settings'), true); |
521 expectEquals( | 521 expectEquals( |
522 printPresetOptions.copies, | 522 printPresetOptions.copies, |
523 parseInt($('copies-settings').querySelector('.copies').value)); | 523 parseInt($('copies-settings').querySelector('.copies').value)); |
524 | 524 |
525 this.waitForAnimationToEnd('other-options-collapsible'); | 525 this.waitForAnimationToEnd('other-options-collapsible'); |
526 }); | 526 }); |
527 | 527 |
| 528 // When the duplex print preset is set for source 'PDF', we update the |
| 529 // duplex setting if capability is supported by printer. |
| 530 TEST_F('PrintPreviewWebUITest', 'CheckDuplexPrintPreset', function() { |
| 531 this.initialSettings_.isDocumentModifiable_ = false; |
| 532 this.setInitialSettings(); |
| 533 this.setLocalDestinations(); |
| 534 this.setCapabilities(getCddTemplate("FooDevice")); |
| 535 |
| 536 // Indicate that the duplex print preset is set to "long edge" for source PDF. |
| 537 var printPresetOptions = { |
| 538 duplex: 1 |
| 539 }; |
| 540 var printPresetOptionsEvent = new Event( |
| 541 print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS); |
| 542 printPresetOptionsEvent.optionsFromDocument = printPresetOptions; |
| 543 this.nativeLayer_.dispatchEvent(printPresetOptionsEvent); |
| 544 |
| 545 var otherOptions = $('other-options-settings'); |
| 546 checkSectionVisible(otherOptions, true); |
| 547 checkElementDisplayed(otherOptions.querySelector('.duplex-container'), true); |
| 548 expectTrue(otherOptions.querySelector('.duplex-checkbox').checked); |
| 549 |
| 550 this.waitForAnimationToEnd('other-options-collapsible'); |
| 551 }); |
| 552 |
528 // Make sure that custom margins controls are properly set up. | 553 // Make sure that custom margins controls are properly set up. |
529 TEST_F('PrintPreviewWebUITest', 'CustomMarginsControlsCheck', function() { | 554 TEST_F('PrintPreviewWebUITest', 'CustomMarginsControlsCheck', function() { |
530 this.setInitialSettings(); | 555 this.setInitialSettings(); |
531 this.setLocalDestinations(); | 556 this.setLocalDestinations(); |
532 this.setCapabilities(getCddTemplate("FooDevice")); | 557 this.setCapabilities(getCddTemplate("FooDevice")); |
533 | 558 |
534 printPreview.printTicketStore_.marginsType.updateValue( | 559 printPreview.printTicketStore_.marginsType.updateValue( |
535 print_preview.ticket_items.MarginsType.Value.CUSTOM); | 560 print_preview.ticket_items.MarginsType.Value.CUSTOM); |
536 | 561 |
537 ['left', 'top', 'right', 'bottom'].forEach(function(margin) { | 562 ['left', 'top', 'right', 'bottom'].forEach(function(margin) { |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 expectEquals( | 963 expectEquals( |
939 customLocalizedMediaName, | 964 customLocalizedMediaName, |
940 mediaSelect.options[mediaSelect.selectedIndex].text); | 965 mediaSelect.options[mediaSelect.selectedIndex].text); |
941 // Check the other media item. | 966 // Check the other media item. |
942 expectEquals( | 967 expectEquals( |
943 customMediaName, | 968 customMediaName, |
944 mediaSelect.options[mediaSelect.selectedIndex == 0 ? 1 : 0].text); | 969 mediaSelect.options[mediaSelect.selectedIndex == 0 ? 1 : 0].text); |
945 | 970 |
946 this.waitForAnimationToEnd('more-settings'); | 971 this.waitForAnimationToEnd('more-settings'); |
947 }); | 972 }); |
OLD | NEW |