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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 this.nativeLayer_, print_preview.NativeLayer.EventType.DISABLE_SCALING); | 403 this.nativeLayer_, print_preview.NativeLayer.EventType.DISABLE_SCALING); |
404 | 404 |
405 checkElementDisplayed( | 405 checkElementDisplayed( |
406 $('other-options-settings').querySelector('.fit-to-page-container'), | 406 $('other-options-settings').querySelector('.fit-to-page-container'), |
407 true); | 407 true); |
408 expectFalse( | 408 expectFalse( |
409 $('other-options-settings').querySelector('.fit-to-page-checkbox'). | 409 $('other-options-settings').querySelector('.fit-to-page-checkbox'). |
410 checked); | 410 checked); |
411 }); | 411 }); |
412 | 412 |
| 413 // Make sure that custom margins controls are properly set up. |
| 414 TEST_F('PrintPreviewWebUITest', 'CustomMarginsControlsCheck', function() { |
| 415 var initialSettingsSetEvent = |
| 416 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); |
| 417 initialSettingsSetEvent.initialSettings = this.initialSettings_; |
| 418 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
| 419 |
| 420 var localDestsSetEvent = |
| 421 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); |
| 422 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; |
| 423 this.nativeLayer_.dispatchEvent(localDestsSetEvent); |
| 424 |
| 425 var capsSetEvent = |
| 426 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
| 427 capsSetEvent.settingsInfo = { |
| 428 'printerId': 'FooDevice', |
| 429 'disableColorOption': false, |
| 430 'setColorAsDefault': true, |
| 431 'disableCopiesOption': true, |
| 432 'disableLandscapeOption': true, |
| 433 'printerDefaultDuplexValue': 0 |
| 434 }; |
| 435 this.nativeLayer_.dispatchEvent(capsSetEvent); |
| 436 |
| 437 printPreview.printTicketStore_.marginsType.updateValue( |
| 438 print_preview.ticket_items.MarginsType.Value.CUSTOM); |
| 439 |
| 440 ['left', 'top', 'right', 'bottom'].forEach(function(margin) { |
| 441 var control = $('preview-area').querySelector('.margin-control-' + margin); |
| 442 assertNotEquals(null, control); |
| 443 var input = control.querySelector('.margin-control-textbox'); |
| 444 assertTrue(input.hasAttribute('aria-label')); |
| 445 assertNotEquals('undefined', input.getAttribute('aria-label')); |
| 446 }); |
| 447 }); |
| 448 |
413 // Page layout has zero margins. Hide header and footer option. | 449 // Page layout has zero margins. Hide header and footer option. |
414 TEST_F('PrintPreviewWebUITest', | 450 TEST_F('PrintPreviewWebUITest', |
415 'PageLayoutHasNoMarginsHideHeaderFooter', | 451 'PageLayoutHasNoMarginsHideHeaderFooter', |
416 function() { | 452 function() { |
417 var initialSettingsSetEvent = | 453 var initialSettingsSetEvent = |
418 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); | 454 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); |
419 initialSettingsSetEvent.initialSettings = this.initialSettings_; | 455 initialSettingsSetEvent.initialSettings = this.initialSettings_; |
420 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); | 456 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
421 | 457 |
422 var localDestsSetEvent = | 458 var localDestsSetEvent = |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 expectEquals(true, previewFailedMessageEl.hidden); | 805 expectEquals(true, previewFailedMessageEl.hidden); |
770 | 806 |
771 var printFailedMessageEl = | 807 var printFailedMessageEl = |
772 previewAreaEl.getElementsByClassName('preview-area-print-failed')[0]; | 808 previewAreaEl.getElementsByClassName('preview-area-print-failed')[0]; |
773 expectEquals(true, printFailedMessageEl.hidden); | 809 expectEquals(true, printFailedMessageEl.hidden); |
774 | 810 |
775 var customMessageEl = | 811 var customMessageEl = |
776 previewAreaEl.getElementsByClassName('preview-area-custom-message')[0]; | 812 previewAreaEl.getElementsByClassName('preview-area-custom-message')[0]; |
777 expectEquals(false, customMessageEl.hidden); | 813 expectEquals(false, customMessageEl.hidden); |
778 }); | 814 }); |
OLD | NEW |