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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 }); | 258 }); |
259 | 259 |
260 // When the source is 'PDF' and 'Save as PDF' option is selected, we hide the | 260 // When the source is 'PDF' and 'Save as PDF' option is selected, we hide the |
261 // fit to page option. | 261 // fit to page option. |
262 TEST_F('PrintPreviewWebUITest', | 262 TEST_F('PrintPreviewWebUITest', |
263 'PrintToPDFSelectedHideFitToPageOption', | 263 'PrintToPDFSelectedHideFitToPageOption', |
264 function() { | 264 function() { |
265 // Add PDF printer. | 265 // Add PDF printer. |
266 this.initialSettings_.isDocumentModifiable_ = false; | 266 this.initialSettings_.isDocumentModifiable_ = false; |
267 this.initialSettings_.systemDefaultDestinationId_ = 'Save as PDF'; | 267 this.initialSettings_.systemDefaultDestinationId_ = 'Save as PDF'; |
268 this.localDestinationInfos_.push( | |
269 {printerName: 'Save as PDF', deviceName: 'Save as PDF'}); | |
270 | 268 |
271 var initialSettingsSetEvent = | 269 var initialSettingsSetEvent = |
272 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); | 270 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); |
273 initialSettingsSetEvent.initialSettings = this.initialSettings_; | 271 initialSettingsSetEvent.initialSettings = this.initialSettings_; |
274 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); | 272 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
275 | 273 |
276 var localDestsSetEvent = | |
277 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); | |
278 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; | |
279 this.nativeLayer_.dispatchEvent(localDestsSetEvent); | |
280 | |
281 var capsSetEvent = | 274 var capsSetEvent = |
282 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 275 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
283 capsSetEvent.settingsInfo = { | 276 capsSetEvent.settingsInfo = { |
284 'printerId': 'FooDevice', | 277 printerId: 'Save as PDF', |
285 'disableColorOption': false, | 278 capabilities: { |
286 'setColorAsDefault': true, | 279 version: '1.0', |
287 'disableCopiesOption': true, | 280 printer: { |
288 'disableLandscapeOption': true, | 281 page_orientation: { |
289 'printerDefaultDuplexValue': 0 | 282 option: [ |
| 283 {type: 'AUTO', is_default: true}, |
| 284 {type: 'PORTRAIT'}, |
| 285 {type: 'LANDSCAPE'} |
| 286 ] |
| 287 }, |
| 288 color: { |
| 289 option: [ |
| 290 {type: 'STANDARD_COLOR', is_default: true} |
| 291 ] |
| 292 }, |
| 293 media_size: { |
| 294 option: [ |
| 295 { name: 'NA_LETTER', |
| 296 width_microns: 0, |
| 297 height_microns: 0, |
| 298 is_default: true |
| 299 } |
| 300 ] |
| 301 } |
| 302 } |
| 303 } |
290 }; | 304 }; |
291 this.nativeLayer_.dispatchEvent(capsSetEvent); | 305 this.nativeLayer_.dispatchEvent(capsSetEvent); |
292 | 306 |
293 checkElementDisplayed( | 307 checkSectionVisible($('other-options-settings'), false); |
294 $('other-options-settings').querySelector('.fit-to-page-container'), | |
295 false); | |
296 }); | 308 }); |
297 | 309 |
298 // When the source is 'HTML', we always hide the fit to page option. | 310 // When the source is 'HTML', we always hide the fit to page option. |
299 TEST_F('PrintPreviewWebUITest', 'SourceIsHTMLHideFitToPageOption', function() { | 311 TEST_F('PrintPreviewWebUITest', 'SourceIsHTMLHideFitToPageOption', function() { |
300 var initialSettingsSetEvent = | 312 var initialSettingsSetEvent = |
301 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); | 313 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); |
302 initialSettingsSetEvent.initialSettings = this.initialSettings_; | 314 initialSettingsSetEvent.initialSettings = this.initialSettings_; |
303 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); | 315 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
304 | 316 |
305 var localDestsSetEvent = | 317 var localDestsSetEvent = |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 expectEquals(true, previewFailedMessageEl.hidden); | 769 expectEquals(true, previewFailedMessageEl.hidden); |
758 | 770 |
759 var printFailedMessageEl = | 771 var printFailedMessageEl = |
760 previewAreaEl.getElementsByClassName('preview-area-print-failed')[0]; | 772 previewAreaEl.getElementsByClassName('preview-area-print-failed')[0]; |
761 expectEquals(true, printFailedMessageEl.hidden); | 773 expectEquals(true, printFailedMessageEl.hidden); |
762 | 774 |
763 var customMessageEl = | 775 var customMessageEl = |
764 previewAreaEl.getElementsByClassName('preview-area-custom-message')[0]; | 776 previewAreaEl.getElementsByClassName('preview-area-custom-message')[0]; |
765 expectEquals(false, customMessageEl.hidden); | 777 expectEquals(false, customMessageEl.hidden); |
766 }); | 778 }); |
OLD | NEW |