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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 delete capsSetEvent.settingsInfo.capabilities.printer.copies; | 306 delete capsSetEvent.settingsInfo.capabilities.printer.copies; |
307 this.nativeLayer_.dispatchEvent(capsSetEvent); | 307 this.nativeLayer_.dispatchEvent(capsSetEvent); |
308 | 308 |
309 checkSectionVisible($('layout-settings'), true); | 309 checkSectionVisible($('layout-settings'), true); |
310 checkSectionVisible($('color-settings'), false); | 310 checkSectionVisible($('color-settings'), false); |
311 checkSectionVisible($('copies-settings'), false); | 311 checkSectionVisible($('copies-settings'), false); |
312 }); | 312 }); |
313 | 313 |
314 // When the source is 'PDF' and 'Save as PDF' option is selected, we hide the | 314 // When the source is 'PDF' and 'Save as PDF' option is selected, we hide the |
315 // fit to page option. | 315 // fit to page option. |
316 TEST_F('PrintPreviewWebUITest', | 316 TEST_F('PrintPreviewWebUITest', 'PrintToPDFSelectedCapabilities', function() { |
317 'PrintToPDFSelectedHideFitToPageOption', | |
318 function() { | |
319 // Add PDF printer. | 317 // Add PDF printer. |
320 this.initialSettings_.isDocumentModifiable_ = false; | 318 this.initialSettings_.isDocumentModifiable_ = false; |
321 this.initialSettings_.systemDefaultDestinationId_ = 'Save as PDF'; | 319 this.initialSettings_.systemDefaultDestinationId_ = 'Save as PDF'; |
322 | 320 |
323 var initialSettingsSetEvent = | 321 var initialSettingsSetEvent = |
324 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); | 322 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); |
325 initialSettingsSetEvent.initialSettings = this.initialSettings_; | 323 initialSettingsSetEvent.initialSettings = this.initialSettings_; |
326 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); | 324 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
327 | 325 |
328 var capsSetEvent = | 326 var capsSetEvent = |
(...skipping 23 matching lines...) Expand all Loading... |
352 is_default: true | 350 is_default: true |
353 } | 351 } |
354 ] | 352 ] |
355 } | 353 } |
356 } | 354 } |
357 } | 355 } |
358 }; | 356 }; |
359 this.nativeLayer_.dispatchEvent(capsSetEvent); | 357 this.nativeLayer_.dispatchEvent(capsSetEvent); |
360 | 358 |
361 checkSectionVisible($('other-options-settings'), false); | 359 checkSectionVisible($('other-options-settings'), false); |
| 360 checkSectionVisible($('media-size-settings'), false); |
362 }); | 361 }); |
363 | 362 |
364 // When the source is 'HTML', we always hide the fit to page option and show | 363 // When the source is 'HTML', we always hide the fit to page option and show |
365 // media size option. | 364 // media size option. |
366 TEST_F('PrintPreviewWebUITest', 'SourceIsHTMLCapabilities', function() { | 365 TEST_F('PrintPreviewWebUITest', 'SourceIsHTMLCapabilities', function() { |
367 var initialSettingsSetEvent = | 366 var initialSettingsSetEvent = |
368 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); | 367 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); |
369 initialSettingsSetEvent.initialSettings = this.initialSettings_; | 368 initialSettingsSetEvent.initialSettings = this.initialSettings_; |
370 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); | 369 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
371 | 370 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 403 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
405 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); | 404 capsSetEvent.settingsInfo = getCddTemplate("FooDevice"); |
406 this.nativeLayer_.dispatchEvent(capsSetEvent); | 405 this.nativeLayer_.dispatchEvent(capsSetEvent); |
407 | 406 |
408 checkElementDisplayed( | 407 checkElementDisplayed( |
409 $('other-options-settings').querySelector('.fit-to-page-container'), | 408 $('other-options-settings').querySelector('.fit-to-page-container'), |
410 true); | 409 true); |
411 expectTrue( | 410 expectTrue( |
412 $('other-options-settings').querySelector('.fit-to-page-checkbox'). | 411 $('other-options-settings').querySelector('.fit-to-page-checkbox'). |
413 checked); | 412 checked); |
414 checkSectionVisible($('media-size-settings'), false); | 413 checkSectionVisible($('media-size-settings'), true); |
415 }); | 414 }); |
416 | 415 |
417 // When the print scaling is disabled for the source "PDF", we show the fit | 416 // When the print scaling is disabled for the source "PDF", we show the fit |
418 // to page option but the state is unchecked by default. | 417 // to page option but the state is unchecked by default. |
419 TEST_F('PrintPreviewWebUITest', 'PrintScalingDisabledForPlugin', function() { | 418 TEST_F('PrintPreviewWebUITest', 'PrintScalingDisabledForPlugin', function() { |
420 this.initialSettings_.isDocumentModifiable_ = false; | 419 this.initialSettings_.isDocumentModifiable_ = false; |
421 | 420 |
422 var initialSettingsSetEvent = | 421 var initialSettingsSetEvent = |
423 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); | 422 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); |
424 initialSettingsSetEvent.initialSettings = this.initialSettings_; | 423 initialSettingsSetEvent.initialSettings = this.initialSettings_; |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 expectEquals(true, previewFailedMessageEl.hidden); | 852 expectEquals(true, previewFailedMessageEl.hidden); |
854 | 853 |
855 var printFailedMessageEl = | 854 var printFailedMessageEl = |
856 previewAreaEl.getElementsByClassName('preview-area-print-failed')[0]; | 855 previewAreaEl.getElementsByClassName('preview-area-print-failed')[0]; |
857 expectEquals(true, printFailedMessageEl.hidden); | 856 expectEquals(true, printFailedMessageEl.hidden); |
858 | 857 |
859 var customMessageEl = | 858 var customMessageEl = |
860 previewAreaEl.getElementsByClassName('preview-area-custom-message')[0]; | 859 previewAreaEl.getElementsByClassName('preview-area-custom-message')[0]; |
861 expectEquals(false, customMessageEl.hidden); | 860 expectEquals(false, customMessageEl.hidden); |
862 }); | 861 }); |
OLD | NEW |