| 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 visible, section.classList.contains('visible'), 'section=' + section.id); | 217 visible, section.classList.contains('visible'), 'section=' + section.id); |
| 218 } | 218 } |
| 219 | 219 |
| 220 function checkElementDisplayed(el, isDisplayed) { | 220 function checkElementDisplayed(el, isDisplayed) { |
| 221 assertNotEquals(null, el); | 221 assertNotEquals(null, el); |
| 222 expectEquals(isDisplayed, !el.hidden); | 222 expectEquals(isDisplayed, !el.hidden); |
| 223 } | 223 } |
| 224 | 224 |
| 225 // Test that disabled settings hide the disabled sections. | 225 // Test that disabled settings hide the disabled sections. |
| 226 TEST_F('PrintPreviewWebUITest', 'TestSectionsDisabled', function() { | 226 TEST_F('PrintPreviewWebUITest', 'TestSectionsDisabled', function() { |
| 227 checkSectionVisible($('layout-settings'), true); |
| 228 checkSectionVisible($('color-settings'), true); |
| 229 checkSectionVisible($('copies-settings'), true); |
| 230 |
| 227 var initialSettingsSetEvent = | 231 var initialSettingsSetEvent = |
| 228 new cr.Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); | 232 new cr.Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); |
| 229 initialSettingsSetEvent.initialSettings = this.initialSettings_; | 233 initialSettingsSetEvent.initialSettings = this.initialSettings_; |
| 230 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); | 234 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
| 231 | 235 |
| 232 var localDestsSetEvent = | 236 var localDestsSetEvent = |
| 233 new cr.Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); | 237 new cr.Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); |
| 234 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; | 238 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; |
| 235 this.nativeLayer_.dispatchEvent(localDestsSetEvent); | 239 this.nativeLayer_.dispatchEvent(localDestsSetEvent); |
| 236 | 240 |
| 237 checkSectionVisible($('layout-settings'), true); | |
| 238 checkSectionVisible($('color-settings'), true); | |
| 239 checkSectionVisible($('copies-settings'), true); | |
| 240 | |
| 241 var capsSetEvent = | 241 var capsSetEvent = |
| 242 new cr.Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 242 new cr.Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
| 243 capsSetEvent.settingsInfo = { | 243 capsSetEvent.settingsInfo = { |
| 244 'printerId': 'FooDevice', | 244 'printerId': 'FooDevice', |
| 245 'disableColorOption': true, | 245 'disableColorOption': true, |
| 246 'setColorAsDefault': true, | 246 'setColorAsDefault': true, |
| 247 'disableCopiesOption': true, | 247 'disableCopiesOption': true, |
| 248 'disableLandscapeOption': true, | 248 'disableLandscapeOption': true, |
| 249 'printerDefaultDuplexValue': 0 | 249 'printerDefaultDuplexValue': 0 |
| 250 }; | 250 }; |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 expectEquals(true, previewFailedMessageEl.hidden); | 759 expectEquals(true, previewFailedMessageEl.hidden); |
| 760 | 760 |
| 761 var printFailedMessageEl = | 761 var printFailedMessageEl = |
| 762 previewAreaEl.getElementsByClassName('preview-area-print-failed')[0]; | 762 previewAreaEl.getElementsByClassName('preview-area-print-failed')[0]; |
| 763 expectEquals(true, printFailedMessageEl.hidden); | 763 expectEquals(true, printFailedMessageEl.hidden); |
| 764 | 764 |
| 765 var customMessageEl = | 765 var customMessageEl = |
| 766 previewAreaEl.getElementsByClassName('preview-area-custom-message')[0]; | 766 previewAreaEl.getElementsByClassName('preview-area-custom-message')[0]; |
| 767 expectEquals(false, customMessageEl.hidden); | 767 expectEquals(false, customMessageEl.hidden); |
| 768 }); | 768 }); |
| OLD | NEW |