| Index: trunk/src/chrome/test/data/webui/print_preview.js
|
| ===================================================================
|
| --- trunk/src/chrome/test/data/webui/print_preview.js (revision 275710)
|
| +++ trunk/src/chrome/test/data/webui/print_preview.js (working copy)
|
| @@ -87,18 +87,6 @@
|
| }.bind(this));
|
| },
|
|
|
| - setUpPreview: function() {
|
| - var initialSettingsSetEvent =
|
| - new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET);
|
| - initialSettingsSetEvent.initialSettings = this.initialSettings_;
|
| - this.nativeLayer_.dispatchEvent(initialSettingsSetEvent);
|
| -
|
| - var localDestsSetEvent =
|
| - new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET);
|
| - localDestsSetEvent.destinationInfos = this.localDestinationInfos_;
|
| - this.nativeLayer_.dispatchEvent(localDestsSetEvent);
|
| - },
|
| -
|
| /**
|
| * Generate a real C++ class; don't typedef.
|
| * @type {?string}
|
| @@ -596,141 +584,61 @@
|
| true);
|
| });
|
|
|
| -// Test that the color settings, one option, standard monochrome.
|
| -TEST_F('PrintPreviewWebUITest', 'TestColorSettingsMonochrome', function() {
|
| - this.setUpPreview();
|
| +// Test that the color settings are set according to the printer capabilities.
|
| +TEST_F('PrintPreviewWebUITest', 'TestColorSettingsTrue', function() {
|
| + var initialSettingsSetEvent =
|
| + new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET);
|
| + initialSettingsSetEvent.initialSettings = this.initialSettings_;
|
| + this.nativeLayer_.dispatchEvent(initialSettingsSetEvent);
|
|
|
| - // Only one option, standard monochrome.
|
| - var capsSetEvent =
|
| - new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET);
|
| - capsSetEvent.settingsInfo = getCddTemplate("FooDevice");
|
| - capsSetEvent.settingsInfo.capabilities.printer.color = {
|
| - "option": [
|
| - {"is_default": true, "type": "STANDARD_MONOCHROME"}
|
| - ]
|
| - };
|
| - this.nativeLayer_.dispatchEvent(capsSetEvent);
|
| + var localDestsSetEvent =
|
| + new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET);
|
| + localDestsSetEvent.destinationInfos = this.localDestinationInfos_;
|
| + this.nativeLayer_.dispatchEvent(localDestsSetEvent);
|
|
|
| - checkSectionVisible($('color-settings'), false);
|
| -});
|
| -
|
| -// Test that the color settings, one option, custom monochrome.
|
| -TEST_F('PrintPreviewWebUITest', 'TestColorSettingsCustomMonochrome',
|
| - function() {
|
| - this.setUpPreview();
|
| -
|
| - // Only one option, standard monochrome.
|
| var capsSetEvent =
|
| new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET);
|
| capsSetEvent.settingsInfo = getCddTemplate("FooDevice");
|
| - capsSetEvent.settingsInfo.capabilities.printer.color = {
|
| - "option": [
|
| - {"is_default": true, "type": "CUSTOM_MONOCHROME", "vendor_id": "42"}
|
| - ]
|
| - };
|
| this.nativeLayer_.dispatchEvent(capsSetEvent);
|
|
|
| - checkSectionVisible($('color-settings'), false);
|
| -});
|
| + checkSectionVisible($('color-settings'), true);
|
|
|
| -// Test that the color settings, one option, standard color.
|
| -TEST_F('PrintPreviewWebUITest', 'TestColorSettingsColor', function() {
|
| - this.setUpPreview();
|
| -
|
| - var capsSetEvent =
|
| - new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET);
|
| - capsSetEvent.settingsInfo = getCddTemplate("FooDevice");
|
| - capsSetEvent.settingsInfo.capabilities.printer.color = {
|
| - "option": [
|
| - {"is_default": true, "type": "STANDARD_COLOR"}
|
| - ]
|
| - };
|
| - this.nativeLayer_.dispatchEvent(capsSetEvent);
|
| -
|
| - checkSectionVisible($('color-settings'), false);
|
| + var colorOption = $('color-settings').querySelector('.color-option');
|
| + var bwOption = $('color-settings').querySelector('.bw-option');
|
| + expectTrue(colorOption.checked);
|
| + expectFalse(bwOption.checked);
|
| });
|
|
|
| -// Test that the color settings, one option, custom color.
|
| -TEST_F('PrintPreviewWebUITest', 'TestColorSettingsCustomColor', function() {
|
| - this.setUpPreview();
|
| +//Test that the color settings are set according to the printer capabilities.
|
| +TEST_F('PrintPreviewWebUITest', 'TestColorSettingsFalse', function() {
|
| + var initialSettingsSetEvent =
|
| + new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET);
|
| + initialSettingsSetEvent.initialSettings = this.initialSettings_;
|
| + this.nativeLayer_.dispatchEvent(initialSettingsSetEvent);
|
|
|
| - var capsSetEvent =
|
| - new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET);
|
| - capsSetEvent.settingsInfo = getCddTemplate("FooDevice");
|
| - capsSetEvent.settingsInfo.capabilities.printer.color = {
|
| - "option": [
|
| - {"is_default": true, "type": "CUSTOM_COLOR", "vendor_id": "42"}
|
| - ]
|
| - };
|
| - this.nativeLayer_.dispatchEvent(capsSetEvent);
|
| + var localDestsSetEvent =
|
| + new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET);
|
| + localDestsSetEvent.destinationInfos = this.localDestinationInfos_;
|
| + this.nativeLayer_.dispatchEvent(localDestsSetEvent);
|
|
|
| - checkSectionVisible($('color-settings'), false);
|
| -});
|
| -
|
| -// Test that the color settings, two options, both standard, defaults to color.
|
| -TEST_F('PrintPreviewWebUITest', 'TestColorSettingsBothStandardDefaultColor',
|
| - function() {
|
| - this.setUpPreview();
|
| -
|
| var capsSetEvent =
|
| new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET);
|
| capsSetEvent.settingsInfo = getCddTemplate("FooDevice");
|
| capsSetEvent.settingsInfo.capabilities.printer.color = {
|
| "option": [
|
| - {"type": "STANDARD_MONOCHROME"},
|
| - {"is_default": true, "type": "STANDARD_COLOR"}
|
| + {"is_default": true, "type": "STANDARD_MONOCHROME"}
|
| ]
|
| };
|
| this.nativeLayer_.dispatchEvent(capsSetEvent);
|
|
|
| - checkSectionVisible($('color-settings'), true);
|
| - expectTrue($('color-settings').querySelector('.color-option').checked);
|
| - expectFalse($('color-settings').querySelector('.bw-option').checked);
|
| -});
|
| + checkSectionVisible($('color-settings'), false);
|
|
|
| -// Test that the color settings, two options, both standard, defaults to
|
| -// monochrome.
|
| -TEST_F('PrintPreviewWebUITest',
|
| - 'TestColorSettingsBothStandardDefaultMonochrome', function() {
|
| - this.setUpPreview();
|
| -
|
| - var capsSetEvent =
|
| - new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET);
|
| - capsSetEvent.settingsInfo = getCddTemplate("FooDevice");
|
| - capsSetEvent.settingsInfo.capabilities.printer.color = {
|
| - "option": [
|
| - {"is_default": true, "type": "STANDARD_MONOCHROME"},
|
| - {"type": "STANDARD_COLOR"}
|
| - ]
|
| - };
|
| - this.nativeLayer_.dispatchEvent(capsSetEvent);
|
| -
|
| - checkSectionVisible($('color-settings'), true);
|
| - expectFalse($('color-settings').querySelector('.color-option').checked);
|
| - expectTrue($('color-settings').querySelector('.bw-option').checked);
|
| + var colorOption = $('color-settings').querySelector('.color-option');
|
| + var bwOption = $('color-settings').querySelector('.bw-option');
|
| + expectFalse(colorOption.checked);
|
| + expectTrue(bwOption.checked);
|
| });
|
|
|
| -// Test that the color settings, two options, both custom, defaults to color.
|
| -TEST_F('PrintPreviewWebUITest',
|
| - 'TestColorSettingsBothCustomDefaultColor', function() {
|
| - this.setUpPreview();
|
| -
|
| - var capsSetEvent =
|
| - new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET);
|
| - capsSetEvent.settingsInfo = getCddTemplate("FooDevice");
|
| - capsSetEvent.settingsInfo.capabilities.printer.color = {
|
| - "option": [
|
| - {"type": "CUSTOM_MONOCHROME", "vendor_id": "42"},
|
| - {"is_default": true, "type": "CUSTOM_COLOR", "vendor_id": "43"}
|
| - ]
|
| - };
|
| - this.nativeLayer_.dispatchEvent(capsSetEvent);
|
| -
|
| - checkSectionVisible($('color-settings'), true);
|
| - expectTrue($('color-settings').querySelector('.color-option').checked);
|
| - expectFalse($('color-settings').querySelector('.bw-option').checked);
|
| -});
|
| -
|
| // Test to verify that duplex settings are set according to the printer
|
| // capabilities.
|
| TEST_F('PrintPreviewWebUITest', 'TestDuplexSettingsTrue', function() {
|
| @@ -758,8 +666,8 @@
|
| expectFalse(duplexCheckbox.checked);
|
| });
|
|
|
| -// Test to verify that duplex settings are set according to the printer
|
| -// capabilities.
|
| +//Test to verify that duplex settings are set according to the printer
|
| +//capabilities.
|
| TEST_F('PrintPreviewWebUITest', 'TestDuplexSettingsFalse', function() {
|
| var initialSettingsSetEvent =
|
| new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET);
|
|
|