| 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 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 var duplexCheckbox = otherOptionsDiv.querySelector('.duplex-checkbox'); | 651 var duplexCheckbox = otherOptionsDiv.querySelector('.duplex-checkbox'); |
| 652 | 652 |
| 653 var capsSetEvent = | 653 var capsSetEvent = |
| 654 new cr.Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 654 new cr.Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
| 655 capsSetEvent.settingsInfo = { | 655 capsSetEvent.settingsInfo = { |
| 656 'printerId': 'FooDevice', | 656 'printerId': 'FooDevice', |
| 657 'disableColorOption': false, | 657 'disableColorOption': false, |
| 658 'setColorAsDefault': true, | 658 'setColorAsDefault': true, |
| 659 'disableCopiesOption': false, | 659 'disableCopiesOption': false, |
| 660 'disableLandscapeOption': true, | 660 'disableLandscapeOption': true, |
| 661 'printerDefaultDuplexValue': 0 | 661 'printerDefaultDuplexValue': 0, |
| 662 'setDuplexAsDefault': false |
| 662 }; | 663 }; |
| 663 this.nativeLayer_.dispatchEvent(capsSetEvent); | 664 this.nativeLayer_.dispatchEvent(capsSetEvent); |
| 664 | 665 |
| 665 checkSectionVisible(otherOptionsDiv, true); | 666 checkSectionVisible(otherOptionsDiv, true); |
| 666 expectFalse(duplexDiv.hidden); | 667 expectFalse(duplexDiv.hidden); |
| 667 expectFalse(duplexCheckbox.checked); | 668 expectFalse(duplexCheckbox.checked); |
| 668 | 669 |
| 669 // If the printer default duplex value is UNKNOWN_DUPLEX_MODE, hide the | 670 // If the printer default duplex value is UNKNOWN_DUPLEX_MODE, hide the |
| 670 // two sided option. | 671 // two sided option. |
| 671 var capsSetEvent = | 672 var capsSetEvent = |
| (...skipping 12 matching lines...) Expand all Loading... |
| 684 expectTrue(duplexDiv.hidden); | 685 expectTrue(duplexDiv.hidden); |
| 685 | 686 |
| 686 var capsSetEvent = | 687 var capsSetEvent = |
| 687 new cr.Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 688 new cr.Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
| 688 capsSetEvent.settingsInfo = { | 689 capsSetEvent.settingsInfo = { |
| 689 'printerId': 'FooDevice', | 690 'printerId': 'FooDevice', |
| 690 'disableColorOption': false, | 691 'disableColorOption': false, |
| 691 'setColorAsDefault': false, | 692 'setColorAsDefault': false, |
| 692 'disableCopiesOption': false, | 693 'disableCopiesOption': false, |
| 693 'disableLandscapeOption': false, | 694 'disableLandscapeOption': false, |
| 694 'printerDefaultDuplexValue': 1 | 695 'printerDefaultDuplexValue': 1, |
| 696 'setDuplexAsDefault': true |
| 695 }; | 697 }; |
| 696 this.nativeLayer_.dispatchEvent(capsSetEvent); | 698 this.nativeLayer_.dispatchEvent(capsSetEvent); |
| 697 | 699 |
| 698 checkSectionVisible(otherOptionsDiv, true); | 700 checkSectionVisible(otherOptionsDiv, true); |
| 699 expectFalse(duplexDiv.hidden); | 701 expectFalse(duplexDiv.hidden); |
| 700 expectTrue(duplexCheckbox.checked); | 702 expectTrue(duplexCheckbox.checked); |
| 701 }); | 703 }); |
| 702 | 704 |
| 703 // Test that changing the selected printer updates the preview. | 705 // Test that changing the selected printer updates the preview. |
| 704 TEST_F('PrintPreviewWebUITest', 'TestPrinterChangeUpdatesPreview', function() { | 706 TEST_F('PrintPreviewWebUITest', 'TestPrinterChangeUpdatesPreview', function() { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 expectEquals(true, previewFailedMessageEl.hidden); | 768 expectEquals(true, previewFailedMessageEl.hidden); |
| 767 | 769 |
| 768 var printFailedMessageEl = | 770 var printFailedMessageEl = |
| 769 previewAreaEl.getElementsByClassName('preview-area-print-failed')[0]; | 771 previewAreaEl.getElementsByClassName('preview-area-print-failed')[0]; |
| 770 expectEquals(true, printFailedMessageEl.hidden); | 772 expectEquals(true, printFailedMessageEl.hidden); |
| 771 | 773 |
| 772 var customMessageEl = | 774 var customMessageEl = |
| 773 previewAreaEl.getElementsByClassName('preview-area-custom-message')[0]; | 775 previewAreaEl.getElementsByClassName('preview-area-custom-message')[0]; |
| 774 expectEquals(false, customMessageEl.hidden); | 776 expectEquals(false, customMessageEl.hidden); |
| 775 }); | 777 }); |
| OLD | NEW |