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 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); | 768 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); |
769 capsSetEvent.settingsInfo.capabilities.printer.color = { | 769 capsSetEvent.settingsInfo.capabilities.printer.color = { |
770 "option": [ | 770 "option": [ |
771 {"type": "STANDARD_MONOCHROME"}, | 771 {"type": "STANDARD_MONOCHROME"}, |
772 {"is_default": true, "type": "STANDARD_COLOR"} | 772 {"is_default": true, "type": "STANDARD_COLOR"} |
773 ] | 773 ] |
774 }; | 774 }; |
775 this.nativeLayer_.dispatchEvent(capsSetEvent); | 775 this.nativeLayer_.dispatchEvent(capsSetEvent); |
776 | 776 |
777 checkSectionVisible($('color-settings'), true); | 777 checkSectionVisible($('color-settings'), true); |
778 expectTrue($('color-settings').querySelector('.color-option').checked); | 778 expectEquals( |
779 expectFalse($('color-settings').querySelector('.bw-option').checked); | 779 'color', |
| 780 $('color-settings').querySelector('.color-settings-select').value); |
780 }); | 781 }); |
781 | 782 |
782 // Test that the color settings, two options, both standard, defaults to | 783 // Test that the color settings, two options, both standard, defaults to |
783 // monochrome. | 784 // monochrome. |
784 TEST_F('PrintPreviewWebUITest', | 785 TEST_F('PrintPreviewWebUITest', |
785 'TestColorSettingsBothStandardDefaultMonochrome', function() { | 786 'TestColorSettingsBothStandardDefaultMonochrome', function() { |
786 this.setUpPreview(); | 787 this.setUpPreview(); |
787 | 788 |
788 var capsSetEvent = | 789 var capsSetEvent = |
789 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 790 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
790 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); | 791 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); |
791 capsSetEvent.settingsInfo.capabilities.printer.color = { | 792 capsSetEvent.settingsInfo.capabilities.printer.color = { |
792 "option": [ | 793 "option": [ |
793 {"is_default": true, "type": "STANDARD_MONOCHROME"}, | 794 {"is_default": true, "type": "STANDARD_MONOCHROME"}, |
794 {"type": "STANDARD_COLOR"} | 795 {"type": "STANDARD_COLOR"} |
795 ] | 796 ] |
796 }; | 797 }; |
797 this.nativeLayer_.dispatchEvent(capsSetEvent); | 798 this.nativeLayer_.dispatchEvent(capsSetEvent); |
798 | 799 |
799 checkSectionVisible($('color-settings'), true); | 800 checkSectionVisible($('color-settings'), true); |
800 expectFalse($('color-settings').querySelector('.color-option').checked); | 801 expectEquals( |
801 expectTrue($('color-settings').querySelector('.bw-option').checked); | 802 'bw', $('color-settings').querySelector('.color-settings-select').value); |
802 }); | 803 }); |
803 | 804 |
804 // Test that the color settings, two options, both custom, defaults to color. | 805 // Test that the color settings, two options, both custom, defaults to color. |
805 TEST_F('PrintPreviewWebUITest', | 806 TEST_F('PrintPreviewWebUITest', |
806 'TestColorSettingsBothCustomDefaultColor', function() { | 807 'TestColorSettingsBothCustomDefaultColor', function() { |
807 this.setUpPreview(); | 808 this.setUpPreview(); |
808 | 809 |
809 var capsSetEvent = | 810 var capsSetEvent = |
810 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 811 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
811 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); | 812 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); |
812 capsSetEvent.settingsInfo.capabilities.printer.color = { | 813 capsSetEvent.settingsInfo.capabilities.printer.color = { |
813 "option": [ | 814 "option": [ |
814 {"type": "CUSTOM_MONOCHROME", "vendor_id": "42"}, | 815 {"type": "CUSTOM_MONOCHROME", "vendor_id": "42"}, |
815 {"is_default": true, "type": "CUSTOM_COLOR", "vendor_id": "43"} | 816 {"is_default": true, "type": "CUSTOM_COLOR", "vendor_id": "43"} |
816 ] | 817 ] |
817 }; | 818 }; |
818 this.nativeLayer_.dispatchEvent(capsSetEvent); | 819 this.nativeLayer_.dispatchEvent(capsSetEvent); |
819 | 820 |
820 checkSectionVisible($('color-settings'), true); | 821 checkSectionVisible($('color-settings'), true); |
821 expectTrue($('color-settings').querySelector('.color-option').checked); | 822 expectEquals( |
822 expectFalse($('color-settings').querySelector('.bw-option').checked); | 823 'color', |
| 824 $('color-settings').querySelector('.color-settings-select').value); |
823 }); | 825 }); |
824 | 826 |
825 // Test to verify that duplex settings are set according to the printer | 827 // Test to verify that duplex settings are set according to the printer |
826 // capabilities. | 828 // capabilities. |
827 TEST_F('PrintPreviewWebUITest', 'TestDuplexSettingsTrue', function() { | 829 TEST_F('PrintPreviewWebUITest', 'TestDuplexSettingsTrue', function() { |
828 var initialSettingsSetEvent = | 830 var initialSettingsSetEvent = |
829 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); | 831 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); |
830 initialSettingsSetEvent.initialSettings = this.initialSettings_; | 832 initialSettingsSetEvent.initialSettings = this.initialSettings_; |
831 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); | 833 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
832 | 834 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 expectEquals(true, previewFailedMessageEl.hidden); | 941 expectEquals(true, previewFailedMessageEl.hidden); |
940 | 942 |
941 var printFailedMessageEl = | 943 var printFailedMessageEl = |
942 previewAreaEl.getElementsByClassName('preview-area-print-failed')[0]; | 944 previewAreaEl.getElementsByClassName('preview-area-print-failed')[0]; |
943 expectEquals(true, printFailedMessageEl.hidden); | 945 expectEquals(true, printFailedMessageEl.hidden); |
944 | 946 |
945 var customMessageEl = | 947 var customMessageEl = |
946 previewAreaEl.getElementsByClassName('preview-area-custom-message')[0]; | 948 previewAreaEl.getElementsByClassName('preview-area-custom-message')[0]; |
947 expectEquals(false, customMessageEl.hidden); | 949 expectEquals(false, customMessageEl.hidden); |
948 }); | 950 }); |
OLD | NEW |