Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: chrome/test/data/webui/print_preview/print_preview.js

Issue 2893003003: Print Preview: Merge NativeLayerStubs for tests (Closed)
Patch Set: Remove extra variable Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 var ROOT_PATH = '../../../../'; 5 var ROOT_PATH = '../../../../../';
6 6
7 /** 7 /**
8 * Test fixture for print preview WebUI testing. 8 * Test fixture for print preview WebUI testing.
9 * @constructor 9 * @constructor
10 * @extends {testing.Test} 10 * @extends {testing.Test}
11 */ 11 */
12 function PrintPreviewWebUITest() { 12 function PrintPreviewWebUITest() {
13 testing.Test.call(this); 13 testing.Test.call(this);
14 this.printPreview_ = null; 14 this.printPreview_ = null;
15 this.nativeLayer_ = null; 15 this.nativeLayer_ = null;
(...skipping 24 matching lines...) Expand all
40 PrintPreviewWebUITest.BAR_INDEX = 2; 40 PrintPreviewWebUITest.BAR_INDEX = 2;
41 41
42 PrintPreviewWebUITest.prototype = { 42 PrintPreviewWebUITest.prototype = {
43 __proto__: testing.Test.prototype, 43 __proto__: testing.Test.prototype,
44 44
45 /** 45 /**
46 * Browse to the sample page, cause print preview & call preLoad(). 46 * Browse to the sample page, cause print preview & call preLoad().
47 * @type {string} 47 * @type {string}
48 * @override 48 * @override
49 */ 49 */
50 browsePrintPreload: 'print_preview_hello_world_test.html', 50 browsePrintPreload: 'print_preview/print_preview_hello_world_test.html',
51 51
52 /** @override */ 52 /** @override */
53 runAccessibilityChecks: true, 53 runAccessibilityChecks: true,
54 54
55 /** @override */ 55 /** @override */
56 accessibilityIssuesAreErrors: true, 56 accessibilityIssuesAreErrors: true,
57 57
58 /** @override */ 58 /** @override */
59 isAsync: true, 59 isAsync: true,
60 60
61 /** 61 /**
62 * Stub out low-level functionality like the NativeLayer and 62 * Stub out low-level functionality like the NativeLayer and
63 * CloudPrintInterface. 63 * CloudPrintInterface.
64 * @this {PrintPreviewWebUITest} 64 * @this {PrintPreviewWebUITest}
65 * @override 65 * @override
66 */ 66 */
67 preLoad: function() { 67 preLoad: function() {
68 window.isTest = true; 68 window.isTest = true;
69 window.addEventListener('DOMContentLoaded', function() { 69 window.addEventListener('DOMContentLoaded', function() {
70 /**
71 * Test version of the native layer.
72 * @constructor
73 * @extends {settings.TestBrowserProxy}
74 */
75 function NativeLayerStub() {
76 settings.TestBrowserProxy.call(this, [ 'getInitialSettings' ]);
77 this.eventTarget_ = new cr.EventTarget();
78 this.printStarted_ = false;
79 this.generateDraft_ = false;
80 this.initialSettings_ = null;
81 }
82 NativeLayerStub.prototype = {
83 __proto__: settings.TestBrowserProxy.prototype,
84 getEventTarget: function() { return this.eventTarget_; },
85 isPrintStarted: function() { return this.printStarted_; },
86 generateDraft: function() { return this.generateDraft_; },
87 getInitialSettings: function() {
88 this.methodCalled('getInitialSettings');
89 return Promise.resolve(this.initialSettings_);
90 },
91 previewReadyForTest: function() {},
92 startGetLocalDestinations: function() {},
93 startGetPrivetDestinations: function() {},
94 startGetExtensionDestinations: function() {},
95 startGetLocalDestinationCapabilities: function(destinationId) {},
96 startGetPreview: function(destination, printTicketStore, documentInfo,
97 generateDraft, requestId) {
98 this.generateDraft_ = generateDraft;
99 },
100 startHideDialog: function () {},
101 startPrint: function () { this.printStarted_ = true; }
102 };
103 var oldNativeLayerEventType = print_preview.NativeLayer.EventType;
104 var oldDuplexMode = print_preview.NativeLayer.DuplexMode;
105 print_preview.NativeLayer = NativeLayerStub;
106 print_preview.NativeLayer.EventType = oldNativeLayerEventType;
107 print_preview.NativeLayer.DuplexMode = oldDuplexMode;
108
109 function CloudPrintInterfaceStub() { 70 function CloudPrintInterfaceStub() {
110 cr.EventTarget.call(this); 71 cr.EventTarget.call(this);
111 } 72 }
112 CloudPrintInterfaceStub.prototype = { 73 CloudPrintInterfaceStub.prototype = {
113 __proto__: cr.EventTarget.prototype, 74 __proto__: cr.EventTarget.prototype,
114 search: function(isRecent) {} 75 search: function(isRecent) {}
115 }; 76 };
116 var oldCpInterfaceEventType = cloudprint.CloudPrintInterfaceEventType; 77 var oldCpInterfaceEventType = cloudprint.CloudPrintInterfaceEventType;
117 cloudprint.CloudPrintInterface = CloudPrintInterfaceStub; 78 cloudprint.CloudPrintInterface = CloudPrintInterfaceStub;
118 cloudprint.CloudPrintInterfaceEventType = oldCpInterfaceEventType; 79 cloudprint.CloudPrintInterfaceEventType = oldCpInterfaceEventType;
119 80
120 print_preview.PreviewArea.prototype.checkPluginCompatibility_ = 81 print_preview.PreviewArea.prototype.checkPluginCompatibility_ =
121 function() { 82 function() {
122 return false; 83 return false;
123 }; 84 };
124 }.bind(this)); 85 }.bind(this));
125 }, 86 },
126 87
127 extraLibraries: [ 88 extraLibraries: [
128 ROOT_PATH + 'ui/webui/resources/js/cr.js', 89 ROOT_PATH + 'ui/webui/resources/js/cr.js',
129 ROOT_PATH + 'ui/webui/resources/js/promise_resolver.js', 90 ROOT_PATH + 'ui/webui/resources/js/promise_resolver.js',
130 ROOT_PATH + 'ui/webui/resources/js/util.js', 91 ROOT_PATH + 'ui/webui/resources/js/util.js',
131 ROOT_PATH + 'chrome/test/data/webui/settings/test_browser_proxy.js', 92 ROOT_PATH + 'chrome/test/data/webui/settings/test_browser_proxy.js',
93 'native_layer_stub.js',
132 ], 94 ],
133 95
134 /** 96 /**
135 * Creates an instance of print_preview.PrintPreview and initializes the 97 * Creates an instance of print_preview.PrintPreview and initializes the
136 * |nativeLayer_| and |previewArea_|. 98 * |nativeLayer_| and |previewArea_|.
137 */ 99 */
138 createPrintPreview: function() { 100 createPrintPreview: function() {
101 this.nativeLayer_ = new print_preview.NativeLayerStub();
102 print_preview.NativeLayer.setInstance(this.nativeLayer_);
139 this.printPreview_ = new print_preview.PrintPreview(); 103 this.printPreview_ = new print_preview.PrintPreview();
140 this.nativeLayer_ = this.printPreview_.nativeLayer_; 104 this.previewArea_ = this.printPreview_.getPreviewArea();
141 this.previewArea_ = this.printPreview_.previewArea_;
142 }, 105 },
143 106
144 /** 107 /**
145 * Initialize print preview with the initial settings currently stored in 108 * Initialize print preview with the initial settings currently stored in
146 * |this.initialSettings_|. Creates |this.printPreview_| if it does not 109 * |this.initialSettings_|. Creates |this.printPreview_| if it does not
147 * already exist. 110 * already exist.
148 */ 111 */
149 setInitialSettings: function() { 112 setInitialSettings: function() {
150 if (!this.printPreview_) { 113 if (!this.printPreview_)
151 this.printPreview_ = new print_preview.PrintPreview(); 114 this.createPrintPreview();
152 this.nativeLayer_ = this.printPreview_.nativeLayer_; 115 this.nativeLayer_.setInitialSettings(this.initialSettings_);
153 this.previewArea_ = this.printPreview_.previewArea_;
154 }
155 this.nativeLayer_.initialSettings_ = this.initialSettings_;
156 this.printPreview_.initialize(); 116 this.printPreview_.initialize();
157 testing.Test.disableAnimationsAndTransitions(); 117 testing.Test.disableAnimationsAndTransitions();
158 // Enable when failure is resolved. 118 // Enable when failure is resolved.
159 // AX_TEXT_03: http://crbug.com/559209 119 // AX_TEXT_03: http://crbug.com/559209
160 this.accessibilityAuditConfig.ignoreSelectors( 120 this.accessibilityAuditConfig.ignoreSelectors(
161 'multipleLabelableElementsPerLabel', 121 'multipleLabelableElementsPerLabel',
162 '#page-settings > .right-column > *'); 122 '#page-settings > .right-column > *');
163 }, 123 },
164 124
165 /** 125 /**
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 this.localDestinationInfos_ = [ 244 this.localDestinationInfos_ = [
285 { printerName: 'FooName', deviceName: 'FooDevice' }, 245 { printerName: 'FooName', deviceName: 'FooDevice' },
286 { printerName: 'BarName', deviceName: 'BarDevice' } 246 { printerName: 'BarName', deviceName: 'BarDevice' }
287 ]; 247 ];
288 }, 248 },
289 }; 249 };
290 250
291 // Test some basic assumptions about the print preview WebUI. 251 // Test some basic assumptions about the print preview WebUI.
292 TEST_F('PrintPreviewWebUITest', 'TestPrinterList', function() { 252 TEST_F('PrintPreviewWebUITest', 'TestPrinterList', function() {
293 this.setInitialSettings(); 253 this.setInitialSettings();
294 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 254 this.nativeLayer_.whenCalled('getInitialSettings').then(
295 function() { 255 function() {
296 this.setLocalDestinations(); 256 this.setLocalDestinations();
297 var recentList = 257 var recentList =
298 $('destination-search').querySelector('.recent-list ul'); 258 $('destination-search').querySelector('.recent-list ul');
299 var localList = 259 var localList =
300 $('destination-search').querySelector('.local-list ul'); 260 $('destination-search').querySelector('.local-list ul');
301 assertNotEquals(null, recentList); 261 assertNotEquals(null, recentList);
302 assertEquals(1, recentList.childNodes.length); 262 assertEquals(1, recentList.childNodes.length);
303 assertEquals('FooName', 263 assertEquals('FooName',
304 recentList.childNodes.item(0).querySelector( 264 recentList.childNodes.item(0).querySelector(
(...skipping 11 matching lines...) Expand all
316 querySelector('.destination-list-item-name').textContent); 276 querySelector('.destination-list-item-name').textContent);
317 testDone(); 277 testDone();
318 }.bind(this)); 278 }.bind(this));
319 }); 279 });
320 280
321 // Test that the printer list is structured correctly after calling 281 // Test that the printer list is structured correctly after calling
322 // addCloudPrinters with an empty list. 282 // addCloudPrinters with an empty list.
323 TEST_F('PrintPreviewWebUITest', 'TestPrinterListCloudEmpty', function() { 283 TEST_F('PrintPreviewWebUITest', 'TestPrinterListCloudEmpty', function() {
324 this.setInitialSettings(); 284 this.setInitialSettings();
325 285
326 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 286 this.nativeLayer_.whenCalled('getInitialSettings').then(
327 function() { 287 function() {
328 this.setLocalDestinations(); 288 this.setLocalDestinations();
329 289
330 var cloudPrintEnableEvent = 290 var cloudPrintEnableEvent =
331 new Event(print_preview.NativeLayer.EventType.CLOUD_PRINT_ENABLE); 291 new Event(print_preview.NativeLayer.EventType.CLOUD_PRINT_ENABLE);
332 cloudPrintEnableEvent.baseCloudPrintUrl = 'cloudprint url'; 292 cloudPrintEnableEvent.baseCloudPrintUrl = 'cloudprint url';
333 this.nativeLayer_.getEventTarget().dispatchEvent( 293 this.nativeLayer_.getEventTarget().dispatchEvent(
334 cloudPrintEnableEvent); 294 cloudPrintEnableEvent);
335 295
336 var searchDoneEvent = 296 var searchDoneEvent =
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 408
449 // Test restore settings with one destination. 409 // Test restore settings with one destination.
450 TEST_F('PrintPreviewWebUITest', 'TestPrintPreviewRestoreLocalDestination', 410 TEST_F('PrintPreviewWebUITest', 'TestPrintPreviewRestoreLocalDestination',
451 function() { 411 function() {
452 this.initialSettings_.serializedAppStateStr_ = 412 this.initialSettings_.serializedAppStateStr_ =
453 '{"version":2,"recentDestinations":[{"id":"ID", "origin":"local",' + 413 '{"version":2,"recentDestinations":[{"id":"ID", "origin":"local",' +
454 '"account":"", "capabilities":0, "name":"", "extensionId":"",' + 414 '"account":"", "capabilities":0, "name":"", "extensionId":"",' +
455 '"extensionName":""}]}'; 415 '"extensionName":""}]}';
456 416
457 this.setInitialSettings(); 417 this.setInitialSettings();
458 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 418 this.nativeLayer_.whenCalled('getInitialSettings').then(
459 function() { 419 function() {
460 testDone(); 420 testDone();
461 }); 421 });
462 }); 422 });
463 423
464 // Test with multiple destinations 424 // Test with multiple destinations
465 TEST_F('PrintPreviewWebUITest', 'TestPrintPreviewRestoreMultipleDestinations', 425 TEST_F('PrintPreviewWebUITest', 'TestPrintPreviewRestoreMultipleDestinations',
466 function() { 426 function() {
467 var origin = cr.isChromeOS ? "chrome_os" : "local"; 427 var origin = cr.isChromeOS ? "chrome_os" : "local";
468 428
(...skipping 26 matching lines...) Expand all
495 'name': '', 455 'name': '',
496 'extensionId': '', 456 'extensionId': '',
497 'extensionName': '' 457 'extensionName': ''
498 } 458 }
499 ] 459 ]
500 }; 460 };
501 461
502 this.initialSettings_.serializedAppStateStr_ = JSON.stringify(appState); 462 this.initialSettings_.serializedAppStateStr_ = JSON.stringify(appState);
503 this.setInitialSettings(); 463 this.setInitialSettings();
504 464
505 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 465 this.nativeLayer_.whenCalled('getInitialSettings').then(
506 function() { 466 function() {
507 // Set capabilities for the three recently used destinations + 1 more 467 // Set capabilities for the three recently used destinations + 1 more
508 this.setCapabilities(getCddTemplate('ID1')); 468 this.setCapabilities(getCddTemplate('ID1'));
509 this.setCapabilities(getCddTemplate('ID2')); 469 this.setCapabilities(getCddTemplate('ID2'));
510 this.setCapabilities(getCddTemplate('ID3')); 470 this.setCapabilities(getCddTemplate('ID3'));
511 this.setCapabilities(getCddTemplate('ID4')); 471 this.setCapabilities(getCddTemplate('ID4'));
512 472
513 // The most recently used destination should be the currently selected 473 // The most recently used destination should be the currently selected
514 // one. This is ID1. 474 // one. This is ID1.
515 assertEquals( 475 assertEquals(
(...skipping 21 matching lines...) Expand all
537 testDone(); 497 testDone();
538 }.bind(this)); 498 }.bind(this));
539 }); 499 });
540 500
541 TEST_F('PrintPreviewWebUITest', 501 TEST_F('PrintPreviewWebUITest',
542 'TestPrintPreviewDefaultDestinationSelectionRules', function() { 502 'TestPrintPreviewDefaultDestinationSelectionRules', function() {
543 // It also makes sure these rules do override system default destination. 503 // It also makes sure these rules do override system default destination.
544 this.initialSettings_.serializedDefaultDestinationSelectionRulesStr_ = 504 this.initialSettings_.serializedDefaultDestinationSelectionRulesStr_ =
545 '{"namePattern":".*Bar.*"}'; 505 '{"namePattern":".*Bar.*"}';
546 this.setInitialSettings(); 506 this.setInitialSettings();
547 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 507 this.nativeLayer_.whenCalled('getInitialSettings').then(
548 function() { 508 function() {
549 this.setLocalDestinations(); 509 this.setLocalDestinations();
550 510
551 assertEquals( 511 assertEquals(
552 'BarDevice', 512 'BarDevice',
553 this.printPreview_.destinationStore_.selectedDestination.id); 513 this.printPreview_.destinationStore_.selectedDestination.id);
554 514
555 testDone(); 515 testDone();
556 }.bind(this)); 516 }.bind(this));
557 }); 517 });
558 518
559 TEST_F('PrintPreviewWebUITest', 'TestSystemDialogLinkIsHiddenInAppKioskMode', 519 TEST_F('PrintPreviewWebUITest', 'TestSystemDialogLinkIsHiddenInAppKioskMode',
560 function() { 520 function() {
561 if (!cr.isChromeOS) 521 if (!cr.isChromeOS)
562 this.initialSettings_.isInAppKioskMode_ = true; 522 this.initialSettings_.isInAppKioskMode_ = true;
563 523
564 this.setInitialSettings(); 524 this.setInitialSettings();
565 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 525 this.nativeLayer_.whenCalled('getInitialSettings').then(
566 function() { 526 function() {
567 if (cr.isChromeOS) 527 if (cr.isChromeOS)
568 assertEquals(null, $('system-dialog-link')); 528 assertEquals(null, $('system-dialog-link'));
569 else 529 else
570 checkElementDisplayed($('system-dialog-link'), false); 530 checkElementDisplayed($('system-dialog-link'), false);
571 testDone(); 531 testDone();
572 }); 532 });
573 }); 533 });
574 534
575 // Test that disabled settings hide the disabled sections. 535 // Test that disabled settings hide the disabled sections.
576 TEST_F('PrintPreviewWebUITest', 'TestSectionsDisabled', function() { 536 TEST_F('PrintPreviewWebUITest', 'TestSectionsDisabled', function() {
577 this.createPrintPreview(); 537 this.createPrintPreview();
578 checkSectionVisible($('layout-settings'), false); 538 checkSectionVisible($('layout-settings'), false);
579 checkSectionVisible($('color-settings'), false); 539 checkSectionVisible($('color-settings'), false);
580 checkSectionVisible($('copies-settings'), false); 540 checkSectionVisible($('copies-settings'), false);
581 541
582 this.setInitialSettings(); 542 this.setInitialSettings();
583 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 543 this.nativeLayer_.whenCalled('getInitialSettings').then(
584 function() { 544 function() {
585 this.setLocalDestinations(); 545 this.setLocalDestinations();
586 var device = getCddTemplate("FooDevice"); 546 var device = getCddTemplate("FooDevice");
587 device.capabilities.printer.color = { 547 device.capabilities.printer.color = {
588 "option": [ 548 "option": [
589 {"is_default": true, "type": "STANDARD_COLOR"} 549 {"is_default": true, "type": "STANDARD_COLOR"}
590 ] 550 ]
591 }; 551 };
592 delete device.capabilities.printer.copies; 552 delete device.capabilities.printer.copies;
593 this.setCapabilities(device); 553 this.setCapabilities(device);
594 554
595 checkSectionVisible($('layout-settings'), true); 555 checkSectionVisible($('layout-settings'), true);
596 checkSectionVisible($('color-settings'), false); 556 checkSectionVisible($('color-settings'), false);
597 checkSectionVisible($('copies-settings'), false); 557 checkSectionVisible($('copies-settings'), false);
598 558
599 this.waitForAnimationToEnd('other-options-collapsible'); 559 this.waitForAnimationToEnd('other-options-collapsible');
600 }.bind(this)); 560 }.bind(this));
601 }); 561 });
602 562
603 // When the source is 'PDF' and 'Save as PDF' option is selected, we hide the 563 // When the source is 'PDF' and 'Save as PDF' option is selected, we hide the
604 // fit to page option. 564 // fit to page option.
605 TEST_F('PrintPreviewWebUITest', 'PrintToPDFSelectedCapabilities', function() { 565 TEST_F('PrintPreviewWebUITest', 'PrintToPDFSelectedCapabilities', function() {
606 // Add PDF printer. 566 // Add PDF printer.
607 this.initialSettings_.isDocumentModifiable_ = false; 567 this.initialSettings_.isDocumentModifiable_ = false;
608 this.initialSettings_.systemDefaultDestinationId_ = 'Save as PDF'; 568 this.initialSettings_.systemDefaultDestinationId_ = 'Save as PDF';
609 this.setInitialSettings(); 569 this.setInitialSettings();
610 570
611 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 571 this.nativeLayer_.whenCalled('getInitialSettings').then(
612 function() { 572 function() {
613 var device = { 573 var device = {
614 printerId: 'Save as PDF', 574 printerId: 'Save as PDF',
615 capabilities: { 575 capabilities: {
616 version: '1.0', 576 version: '1.0',
617 printer: { 577 printer: {
618 page_orientation: { 578 page_orientation: {
619 option: [ 579 option: [
620 {type: 'AUTO', is_default: true}, 580 {type: 'AUTO', is_default: true},
621 {type: 'PORTRAIT'}, 581 {type: 'PORTRAIT'},
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 checkSectionVisible($('scaling-settings'), false); 615 checkSectionVisible($('scaling-settings'), false);
656 616
657 testDone(); 617 testDone();
658 }.bind(this)); 618 }.bind(this));
659 }); 619 });
660 620
661 // When the source is 'HTML', we always hide the fit to page option and show 621 // When the source is 'HTML', we always hide the fit to page option and show
662 // media size option. 622 // media size option.
663 TEST_F('PrintPreviewWebUITest', 'SourceIsHTMLCapabilities', function() { 623 TEST_F('PrintPreviewWebUITest', 'SourceIsHTMLCapabilities', function() {
664 this.setInitialSettings(); 624 this.setInitialSettings();
665 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 625 this.nativeLayer_.whenCalled('getInitialSettings').then(
666 function() { 626 function() {
667 this.setLocalDestinations(); 627 this.setLocalDestinations();
668 this.setCapabilities(getCddTemplate("FooDevice")); 628 this.setCapabilities(getCddTemplate("FooDevice"));
669 629
670 var otherOptions = $('other-options-settings'); 630 var otherOptions = $('other-options-settings');
671 var fitToPage = otherOptions.querySelector('#fit-to-page-container'); 631 var fitToPage = otherOptions.querySelector('#fit-to-page-container');
672 var rasterize; 632 var rasterize;
673 if (isPrintAsImageEnabled()) 633 if (isPrintAsImageEnabled())
674 rasterize = otherOptions.querySelector('#rasterize-container'); 634 rasterize = otherOptions.querySelector('#rasterize-container');
675 var mediaSize = $('media-size-settings'); 635 var mediaSize = $('media-size-settings');
(...skipping 18 matching lines...) Expand all
694 654
695 this.waitForAnimationToEnd('more-settings'); 655 this.waitForAnimationToEnd('more-settings');
696 }.bind(this)); 656 }.bind(this));
697 }); 657 });
698 658
699 // When the source is "PDF", depending on the selected destination printer, we 659 // When the source is "PDF", depending on the selected destination printer, we
700 // show/hide the fit to page option and hide media size selection. 660 // show/hide the fit to page option and hide media size selection.
701 TEST_F('PrintPreviewWebUITest', 'SourceIsPDFCapabilities', function() { 661 TEST_F('PrintPreviewWebUITest', 'SourceIsPDFCapabilities', function() {
702 this.initialSettings_.isDocumentModifiable_ = false; 662 this.initialSettings_.isDocumentModifiable_ = false;
703 this.setInitialSettings(); 663 this.setInitialSettings();
704 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 664 this.nativeLayer_.whenCalled('getInitialSettings').then(
705 function() { 665 function() {
706 this.setLocalDestinations(); 666 this.setLocalDestinations();
707 this.setCapabilities(getCddTemplate("FooDevice")); 667 this.setCapabilities(getCddTemplate("FooDevice"));
708 668
709 var otherOptions = $('other-options-settings'); 669 var otherOptions = $('other-options-settings');
710 var scalingSettings = $('scaling-settings'); 670 var scalingSettings = $('scaling-settings');
711 var fitToPageContainer = 671 var fitToPageContainer =
712 otherOptions.querySelector('#fit-to-page-container'); 672 otherOptions.querySelector('#fit-to-page-container');
713 var rasterizeContainer; 673 var rasterizeContainer;
714 if (isPrintAsImageEnabled()) { 674 if (isPrintAsImageEnabled()) {
(...skipping 18 matching lines...) Expand all
733 693
734 this.waitForAnimationToEnd('other-options-collapsible'); 694 this.waitForAnimationToEnd('other-options-collapsible');
735 }.bind(this)); 695 }.bind(this));
736 }); 696 });
737 697
738 // When the source is "PDF", depending on the selected destination printer, we 698 // When the source is "PDF", depending on the selected destination printer, we
739 // show/hide the fit to page option and hide media size selection. 699 // show/hide the fit to page option and hide media size selection.
740 TEST_F('PrintPreviewWebUITest', 'ScalingUnchecksFitToPage', function() { 700 TEST_F('PrintPreviewWebUITest', 'ScalingUnchecksFitToPage', function() {
741 this.initialSettings_.isDocumentModifiable_ = false; 701 this.initialSettings_.isDocumentModifiable_ = false;
742 this.setInitialSettings(); 702 this.setInitialSettings();
743 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 703 this.nativeLayer_.whenCalled('getInitialSettings').then(
744 function() { 704 function() {
745 this.setLocalDestinations(); 705 this.setLocalDestinations();
746 this.setCapabilities(getCddTemplate("FooDevice")); 706 this.setCapabilities(getCddTemplate("FooDevice"));
747 707
748 var otherOptions = $('other-options-settings'); 708 var otherOptions = $('other-options-settings');
749 var scalingSettings = $('scaling-settings'); 709 var scalingSettings = $('scaling-settings');
750 710
751 checkSectionVisible(otherOptions, true); 711 checkSectionVisible(otherOptions, true);
752 var fitToPageContainer = 712 var fitToPageContainer =
753 otherOptions.querySelector('#fit-to-page-container'); 713 otherOptions.querySelector('#fit-to-page-container');
(...skipping 20 matching lines...) Expand all
774 734
775 this.waitForAnimationToEnd('other-options-collapsible'); 735 this.waitForAnimationToEnd('other-options-collapsible');
776 }.bind(this)); 736 }.bind(this));
777 }); 737 });
778 738
779 // When the number of copies print preset is set for source 'PDF', we update 739 // When the number of copies print preset is set for source 'PDF', we update
780 // the copies value if capability is supported by printer. 740 // the copies value if capability is supported by printer.
781 TEST_F('PrintPreviewWebUITest', 'CheckNumCopiesPrintPreset', function() { 741 TEST_F('PrintPreviewWebUITest', 'CheckNumCopiesPrintPreset', function() {
782 this.initialSettings_.isDocumentModifiable_ = false; 742 this.initialSettings_.isDocumentModifiable_ = false;
783 this.setInitialSettings(); 743 this.setInitialSettings();
784 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 744 this.nativeLayer_.whenCalled('getInitialSettings').then(
785 function() { 745 function() {
786 this.setLocalDestinations(); 746 this.setLocalDestinations();
787 this.setCapabilities(getCddTemplate("FooDevice")); 747 this.setCapabilities(getCddTemplate("FooDevice"));
788 748
789 // Indicate that the number of copies print preset is set for source 749 // Indicate that the number of copies print preset is set for source
790 // PDF. 750 // PDF.
791 var printPresetOptions = { 751 var printPresetOptions = {
792 disableScaling: true, 752 disableScaling: true,
793 copies: 2 753 copies: 2
794 }; 754 };
(...skipping 11 matching lines...) Expand all
806 this.waitForAnimationToEnd('other-options-collapsible'); 766 this.waitForAnimationToEnd('other-options-collapsible');
807 }.bind(this)); 767 }.bind(this));
808 }); 768 });
809 769
810 // When the duplex print preset is set for source 'PDF', we update the 770 // When the duplex print preset is set for source 'PDF', we update the
811 // duplex setting if capability is supported by printer. 771 // duplex setting if capability is supported by printer.
812 TEST_F('PrintPreviewWebUITest', 'CheckDuplexPrintPreset', function() { 772 TEST_F('PrintPreviewWebUITest', 'CheckDuplexPrintPreset', function() {
813 this.initialSettings_.isDocumentModifiable_ = false; 773 this.initialSettings_.isDocumentModifiable_ = false;
814 this.setInitialSettings(); 774 this.setInitialSettings();
815 775
816 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 776 this.nativeLayer_.whenCalled('getInitialSettings').then(
817 function() { 777 function() {
818 this.setLocalDestinations(); 778 this.setLocalDestinations();
819 this.setCapabilities(getCddTemplate("FooDevice")); 779 this.setCapabilities(getCddTemplate("FooDevice"));
820 780
821 // Indicate that the duplex print preset is set to "long edge" for 781 // Indicate that the duplex print preset is set to "long edge" for
822 // source PDF. 782 // source PDF.
823 var printPresetOptions = { 783 var printPresetOptions = {
824 duplex: 1 784 duplex: 1
825 }; 785 };
826 var printPresetOptionsEvent = new Event( 786 var printPresetOptionsEvent = new Event(
827 print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS); 787 print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS);
828 printPresetOptionsEvent.optionsFromDocument = printPresetOptions; 788 printPresetOptionsEvent.optionsFromDocument = printPresetOptions;
829 this.nativeLayer_.getEventTarget(). 789 this.nativeLayer_.getEventTarget().
830 dispatchEvent(printPresetOptionsEvent); 790 dispatchEvent(printPresetOptionsEvent);
831 791
832 var otherOptions = $('other-options-settings'); 792 var otherOptions = $('other-options-settings');
833 checkSectionVisible(otherOptions, true); 793 checkSectionVisible(otherOptions, true);
834 var duplexContainer = otherOptions.querySelector('#duplex-container'); 794 var duplexContainer = otherOptions.querySelector('#duplex-container');
835 checkElementDisplayed(duplexContainer, true); 795 checkElementDisplayed(duplexContainer, true);
836 expectTrue(duplexContainer.querySelector('.checkbox').checked); 796 expectTrue(duplexContainer.querySelector('.checkbox').checked);
837 797
838 this.waitForAnimationToEnd('other-options-collapsible'); 798 this.waitForAnimationToEnd('other-options-collapsible');
839 }.bind(this)); 799 }.bind(this));
840 }); 800 });
841 801
842 // Make sure that custom margins controls are properly set up. 802 // Make sure that custom margins controls are properly set up.
843 TEST_F('PrintPreviewWebUITest', 'CustomMarginsControlsCheck', function() { 803 TEST_F('PrintPreviewWebUITest', 'CustomMarginsControlsCheck', function() {
844 this.setInitialSettings(); 804 this.setInitialSettings();
845 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 805 this.nativeLayer_.whenCalled('getInitialSettings').then(
846 function() { 806 function() {
847 this.setLocalDestinations(); 807 this.setLocalDestinations();
848 this.setCapabilities(getCddTemplate("FooDevice")); 808 this.setCapabilities(getCddTemplate("FooDevice"));
849 809
850 this.printPreview_.printTicketStore_.marginsType.updateValue( 810 this.printPreview_.printTicketStore_.marginsType.updateValue(
851 print_preview.ticket_items.MarginsTypeValue.CUSTOM); 811 print_preview.ticket_items.MarginsTypeValue.CUSTOM);
852 812
853 ['left', 'top', 'right', 'bottom'].forEach(function(margin) { 813 ['left', 'top', 'right', 'bottom'].forEach(function(margin) {
854 var control = 814 var control =
855 $('preview-area').querySelector('.margin-control-' + margin); 815 $('preview-area').querySelector('.margin-control-' + margin);
856 assertNotEquals(null, control); 816 assertNotEquals(null, control);
857 var input = control.querySelector('.margin-control-textbox'); 817 var input = control.querySelector('.margin-control-textbox');
858 assertTrue(input.hasAttribute('aria-label')); 818 assertTrue(input.hasAttribute('aria-label'));
859 assertNotEquals('undefined', input.getAttribute('aria-label')); 819 assertNotEquals('undefined', input.getAttribute('aria-label'));
860 }); 820 });
861 this.waitForAnimationToEnd('more-settings'); 821 this.waitForAnimationToEnd('more-settings');
862 }.bind(this)); 822 }.bind(this));
863 }); 823 });
864 824
865 // Page layout has zero margins. Hide header and footer option. 825 // Page layout has zero margins. Hide header and footer option.
866 TEST_F('PrintPreviewWebUITest', 'PageLayoutHasNoMarginsHideHeaderFooter', 826 TEST_F('PrintPreviewWebUITest', 'PageLayoutHasNoMarginsHideHeaderFooter',
867 function() { 827 function() {
868 this.setInitialSettings(); 828 this.setInitialSettings();
869 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 829 this.nativeLayer_.whenCalled('getInitialSettings').then(
870 function() { 830 function() {
871 this.setLocalDestinations(); 831 this.setLocalDestinations();
872 this.setCapabilities(getCddTemplate("FooDevice")); 832 this.setCapabilities(getCddTemplate("FooDevice"));
873 833
874 var otherOptions = $('other-options-settings'); 834 var otherOptions = $('other-options-settings');
875 var headerFooter = 835 var headerFooter =
876 otherOptions.querySelector('#header-footer-container'); 836 otherOptions.querySelector('#header-footer-container');
877 837
878 // Check that options are collapsed (section is visible, because duplex 838 // Check that options are collapsed (section is visible, because duplex
879 // is available). 839 // is available).
(...skipping 12 matching lines...) Expand all
892 checkElementDisplayed(headerFooter, false); 852 checkElementDisplayed(headerFooter, false);
893 853
894 this.waitForAnimationToEnd('more-settings'); 854 this.waitForAnimationToEnd('more-settings');
895 }.bind(this)); 855 }.bind(this));
896 }); 856 });
897 857
898 // Page layout has half-inch margins. Show header and footer option. 858 // Page layout has half-inch margins. Show header and footer option.
899 TEST_F('PrintPreviewWebUITest', 'PageLayoutHasMarginsShowHeaderFooter', 859 TEST_F('PrintPreviewWebUITest', 'PageLayoutHasMarginsShowHeaderFooter',
900 function() { 860 function() {
901 this.setInitialSettings(); 861 this.setInitialSettings();
902 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 862 this.nativeLayer_.whenCalled('getInitialSettings').then(
903 function() { 863 function() {
904 this.setLocalDestinations(); 864 this.setLocalDestinations();
905 this.setCapabilities(getCddTemplate("FooDevice")); 865 this.setCapabilities(getCddTemplate("FooDevice"));
906 866
907 var otherOptions = $('other-options-settings'); 867 var otherOptions = $('other-options-settings');
908 var headerFooter = 868 var headerFooter =
909 otherOptions.querySelector('#header-footer-container'); 869 otherOptions.querySelector('#header-footer-container');
910 870
911 // Check that options are collapsed (section is visible, because duplex 871 // Check that options are collapsed (section is visible, because duplex
912 // is available). 872 // is available).
(...skipping 13 matching lines...) Expand all
926 886
927 this.waitForAnimationToEnd('more-settings'); 887 this.waitForAnimationToEnd('more-settings');
928 }.bind(this)); 888 }.bind(this));
929 }); 889 });
930 890
931 // Page layout has zero top and bottom margins. Hide header and footer option. 891 // Page layout has zero top and bottom margins. Hide header and footer option.
932 TEST_F('PrintPreviewWebUITest', 892 TEST_F('PrintPreviewWebUITest',
933 'ZeroTopAndBottomMarginsHideHeaderFooter', 893 'ZeroTopAndBottomMarginsHideHeaderFooter',
934 function() { 894 function() {
935 this.setInitialSettings(); 895 this.setInitialSettings();
936 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 896 this.nativeLayer_.whenCalled('getInitialSettings').then(
937 function() { 897 function() {
938 this.setLocalDestinations(); 898 this.setLocalDestinations();
939 this.setCapabilities(getCddTemplate("FooDevice")); 899 this.setCapabilities(getCddTemplate("FooDevice"));
940 900
941 var otherOptions = $('other-options-settings'); 901 var otherOptions = $('other-options-settings');
942 var headerFooter = 902 var headerFooter =
943 otherOptions.querySelector('#header-footer-container'); 903 otherOptions.querySelector('#header-footer-container');
944 904
945 // Check that options are collapsed (section is visible, because duplex 905 // Check that options are collapsed (section is visible, because duplex
946 // is available). 906 // is available).
(...skipping 14 matching lines...) Expand all
961 this.waitForAnimationToEnd('more-settings'); 921 this.waitForAnimationToEnd('more-settings');
962 }.bind(this)); 922 }.bind(this));
963 }); 923 });
964 924
965 // Page layout has zero top and half-inch bottom margin. Show header and footer 925 // Page layout has zero top and half-inch bottom margin. Show header and footer
966 // option. 926 // option.
967 TEST_F('PrintPreviewWebUITest', 927 TEST_F('PrintPreviewWebUITest',
968 'ZeroTopAndNonZeroBottomMarginShowHeaderFooter', 928 'ZeroTopAndNonZeroBottomMarginShowHeaderFooter',
969 function() { 929 function() {
970 this.setInitialSettings(); 930 this.setInitialSettings();
971 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 931 this.nativeLayer_.whenCalled('getInitialSettings').then(
972 function() { 932 function() {
973 this.setLocalDestinations(); 933 this.setLocalDestinations();
974 this.setCapabilities(getCddTemplate("FooDevice")); 934 this.setCapabilities(getCddTemplate("FooDevice"));
975 935
976 var otherOptions = $('other-options-settings'); 936 var otherOptions = $('other-options-settings');
977 var headerFooter = 937 var headerFooter =
978 otherOptions.querySelector('#header-footer-container'); 938 otherOptions.querySelector('#header-footer-container');
979 939
980 // Check that options are collapsed (section is visible, because duplex 940 // Check that options are collapsed (section is visible, because duplex
981 // is available). 941 // is available).
(...skipping 11 matching lines...) Expand all
993 953
994 checkElementDisplayed(headerFooter, true); 954 checkElementDisplayed(headerFooter, true);
995 955
996 this.waitForAnimationToEnd('more-settings'); 956 this.waitForAnimationToEnd('more-settings');
997 }.bind(this)); 957 }.bind(this));
998 }); 958 });
999 959
1000 // Check header footer availability with small (label) page size. 960 // Check header footer availability with small (label) page size.
1001 TEST_F('PrintPreviewWebUITest', 'SmallPaperSizeHeaderFooter', function() { 961 TEST_F('PrintPreviewWebUITest', 'SmallPaperSizeHeaderFooter', function() {
1002 this.setInitialSettings(); 962 this.setInitialSettings();
1003 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 963 this.nativeLayer_.whenCalled('getInitialSettings').then(
1004 function() { 964 function() {
1005 this.setLocalDestinations(); 965 this.setLocalDestinations();
1006 var device = getCddTemplate("FooDevice"); 966 var device = getCddTemplate("FooDevice");
1007 device.capabilities.printer.media_size = { 967 device.capabilities.printer.media_size = {
1008 "option": [ 968 "option": [
1009 {"name": "SmallLabel", "width_microns": 38100, 969 {"name": "SmallLabel", "width_microns": 38100,
1010 "height_microns": 12700, "is_default": false}, 970 "height_microns": 12700, "is_default": false},
1011 {"name": "BigLabel", "width_microns": 50800, 971 {"name": "BigLabel", "width_microns": 50800,
1012 "height_microns": 76200, "is_default": true} 972 "height_microns": 76200, "is_default": true}
1013 ] 973 ]
(...skipping 24 matching lines...) Expand all
1038 this.printPreview_.printTicketStore_.landscape.updateValue(true); 998 this.printPreview_.printTicketStore_.landscape.updateValue(true);
1039 checkElementDisplayed(headerFooter, true); 999 checkElementDisplayed(headerFooter, true);
1040 1000
1041 this.waitForAnimationToEnd('more-settings'); 1001 this.waitForAnimationToEnd('more-settings');
1042 }.bind(this)); 1002 }.bind(this));
1043 }); 1003 });
1044 1004
1045 // Test that the color settings, one option, standard monochrome. 1005 // Test that the color settings, one option, standard monochrome.
1046 TEST_F('PrintPreviewWebUITest', 'TestColorSettingsMonochrome', function() { 1006 TEST_F('PrintPreviewWebUITest', 'TestColorSettingsMonochrome', function() {
1047 this.setInitialSettings(); 1007 this.setInitialSettings();
1048 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 1008 this.nativeLayer_.whenCalled('getInitialSettings').then(
1049 function() { 1009 function() {
1050 this.setLocalDestinations(); 1010 this.setLocalDestinations();
1051 1011
1052 // Only one option, standard monochrome. 1012 // Only one option, standard monochrome.
1053 var device = getCddTemplate("FooDevice"); 1013 var device = getCddTemplate("FooDevice");
1054 device.capabilities.printer.color = { 1014 device.capabilities.printer.color = {
1055 "option": [ 1015 "option": [
1056 {"is_default": true, "type": "STANDARD_MONOCHROME"} 1016 {"is_default": true, "type": "STANDARD_MONOCHROME"}
1057 ] 1017 ]
1058 }; 1018 };
1059 this.setCapabilities(device); 1019 this.setCapabilities(device);
1060 1020
1061 checkSectionVisible($('color-settings'), false); 1021 checkSectionVisible($('color-settings'), false);
1062 1022
1063 this.waitForAnimationToEnd('more-settings'); 1023 this.waitForAnimationToEnd('more-settings');
1064 }.bind(this)); 1024 }.bind(this));
1065 }); 1025 });
1066 1026
1067 // Test that the color settings, one option, custom monochrome. 1027 // Test that the color settings, one option, custom monochrome.
1068 TEST_F('PrintPreviewWebUITest', 'TestColorSettingsCustomMonochrome', 1028 TEST_F('PrintPreviewWebUITest', 'TestColorSettingsCustomMonochrome',
1069 function() { 1029 function() {
1070 this.setInitialSettings(); 1030 this.setInitialSettings();
1071 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 1031 this.nativeLayer_.whenCalled('getInitialSettings').then(
1072 function() { 1032 function() {
1073 this.setLocalDestinations(); 1033 this.setLocalDestinations();
1074 1034
1075 // Only one option, standard monochrome. 1035 // Only one option, standard monochrome.
1076 var device = getCddTemplate("FooDevice"); 1036 var device = getCddTemplate("FooDevice");
1077 device.capabilities.printer.color = { 1037 device.capabilities.printer.color = {
1078 "option": [ 1038 "option": [
1079 {"is_default": true, "type": "CUSTOM_MONOCHROME", 1039 {"is_default": true, "type": "CUSTOM_MONOCHROME",
1080 "vendor_id": "42"} 1040 "vendor_id": "42"}
1081 ] 1041 ]
1082 }; 1042 };
1083 this.setCapabilities(device); 1043 this.setCapabilities(device);
1084 1044
1085 checkSectionVisible($('color-settings'), false); 1045 checkSectionVisible($('color-settings'), false);
1086 1046
1087 this.waitForAnimationToEnd('more-settings'); 1047 this.waitForAnimationToEnd('more-settings');
1088 }.bind(this)); 1048 }.bind(this));
1089 }); 1049 });
1090 1050
1091 // Test that the color settings, one option, standard color. 1051 // Test that the color settings, one option, standard color.
1092 TEST_F('PrintPreviewWebUITest', 'TestColorSettingsColor', function() { 1052 TEST_F('PrintPreviewWebUITest', 'TestColorSettingsColor', function() {
1093 this.setInitialSettings(); 1053 this.setInitialSettings();
1094 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 1054 this.nativeLayer_.whenCalled('getInitialSettings').then(
1095 function() { 1055 function() {
1096 this.setLocalDestinations(); 1056 this.setLocalDestinations();
1097 1057
1098 var device = getCddTemplate("FooDevice"); 1058 var device = getCddTemplate("FooDevice");
1099 device.capabilities.printer.color = { 1059 device.capabilities.printer.color = {
1100 "option": [ 1060 "option": [
1101 {"is_default": true, "type": "STANDARD_COLOR"} 1061 {"is_default": true, "type": "STANDARD_COLOR"}
1102 ] 1062 ]
1103 }; 1063 };
1104 this.setCapabilities(device); 1064 this.setCapabilities(device);
1105 1065
1106 checkSectionVisible($('color-settings'), false); 1066 checkSectionVisible($('color-settings'), false);
1107 1067
1108 this.waitForAnimationToEnd('more-settings'); 1068 this.waitForAnimationToEnd('more-settings');
1109 }.bind(this)); 1069 }.bind(this));
1110 }); 1070 });
1111 1071
1112 // Test that the color settings, one option, custom color. 1072 // Test that the color settings, one option, custom color.
1113 TEST_F('PrintPreviewWebUITest', 'TestColorSettingsCustomColor', function() { 1073 TEST_F('PrintPreviewWebUITest', 'TestColorSettingsCustomColor', function() {
1114 this.setInitialSettings(); 1074 this.setInitialSettings();
1115 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 1075 this.nativeLayer_.whenCalled('getInitialSettings').then(
1116 function() { 1076 function() {
1117 this.setLocalDestinations(); 1077 this.setLocalDestinations();
1118 1078
1119 var device = getCddTemplate("FooDevice"); 1079 var device = getCddTemplate("FooDevice");
1120 device.capabilities.printer.color = { 1080 device.capabilities.printer.color = {
1121 "option": [ 1081 "option": [
1122 {"is_default": true, "type": "CUSTOM_COLOR", "vendor_id": "42"} 1082 {"is_default": true, "type": "CUSTOM_COLOR", "vendor_id": "42"}
1123 ] 1083 ]
1124 }; 1084 };
1125 this.setCapabilities(device); 1085 this.setCapabilities(device);
1126 1086
1127 checkSectionVisible($('color-settings'), false); 1087 checkSectionVisible($('color-settings'), false);
1128 1088
1129 this.waitForAnimationToEnd('more-settings'); 1089 this.waitForAnimationToEnd('more-settings');
1130 }.bind(this)); 1090 }.bind(this));
1131 }); 1091 });
1132 1092
1133 // Test that the color settings, two options, both standard, defaults to color. 1093 // Test that the color settings, two options, both standard, defaults to color.
1134 TEST_F('PrintPreviewWebUITest', 'TestColorSettingsBothStandardDefaultColor', 1094 TEST_F('PrintPreviewWebUITest', 'TestColorSettingsBothStandardDefaultColor',
1135 function() { 1095 function() {
1136 this.setInitialSettings(); 1096 this.setInitialSettings();
1137 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 1097 this.nativeLayer_.whenCalled('getInitialSettings').then(
1138 function() { 1098 function() {
1139 this.setLocalDestinations(); 1099 this.setLocalDestinations();
1140 1100
1141 var device = getCddTemplate("FooDevice"); 1101 var device = getCddTemplate("FooDevice");
1142 device.capabilities.printer.color = { 1102 device.capabilities.printer.color = {
1143 "option": [ 1103 "option": [
1144 {"type": "STANDARD_MONOCHROME"}, 1104 {"type": "STANDARD_MONOCHROME"},
1145 {"is_default": true, "type": "STANDARD_COLOR"} 1105 {"is_default": true, "type": "STANDARD_COLOR"}
1146 ] 1106 ]
1147 }; 1107 };
1148 this.setCapabilities(device); 1108 this.setCapabilities(device);
1149 1109
1150 checkSectionVisible($('color-settings'), true); 1110 checkSectionVisible($('color-settings'), true);
1151 expectEquals( 1111 expectEquals(
1152 'color', 1112 'color',
1153 $('color-settings').querySelector('.color-settings-select').value); 1113 $('color-settings').querySelector('.color-settings-select').value);
1154 1114
1155 this.waitForAnimationToEnd('more-settings'); 1115 this.waitForAnimationToEnd('more-settings');
1156 }.bind(this)); 1116 }.bind(this));
1157 }); 1117 });
1158 1118
1159 // Test that the color settings, two options, both standard, defaults to 1119 // Test that the color settings, two options, both standard, defaults to
1160 // monochrome. 1120 // monochrome.
1161 TEST_F('PrintPreviewWebUITest', 1121 TEST_F('PrintPreviewWebUITest',
1162 'TestColorSettingsBothStandardDefaultMonochrome', function() { 1122 'TestColorSettingsBothStandardDefaultMonochrome', function() {
1163 this.setInitialSettings(); 1123 this.setInitialSettings();
1164 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 1124 this.nativeLayer_.whenCalled('getInitialSettings').then(
1165 function() { 1125 function() {
1166 this.setLocalDestinations(); 1126 this.setLocalDestinations();
1167 1127
1168 var device = getCddTemplate("FooDevice"); 1128 var device = getCddTemplate("FooDevice");
1169 device.capabilities.printer.color = { 1129 device.capabilities.printer.color = {
1170 "option": [ 1130 "option": [
1171 {"is_default": true, "type": "STANDARD_MONOCHROME"}, 1131 {"is_default": true, "type": "STANDARD_MONOCHROME"},
1172 {"type": "STANDARD_COLOR"} 1132 {"type": "STANDARD_COLOR"}
1173 ] 1133 ]
1174 }; 1134 };
1175 this.setCapabilities(device); 1135 this.setCapabilities(device);
1176 1136
1177 checkSectionVisible($('color-settings'), true); 1137 checkSectionVisible($('color-settings'), true);
1178 expectEquals( 1138 expectEquals(
1179 'bw', 1139 'bw',
1180 $('color-settings').querySelector('.color-settings-select').value); 1140 $('color-settings').querySelector('.color-settings-select').value);
1181 1141
1182 this.waitForAnimationToEnd('more-settings'); 1142 this.waitForAnimationToEnd('more-settings');
1183 }.bind(this)); 1143 }.bind(this));
1184 }); 1144 });
1185 1145
1186 // Test that the color settings, two options, both custom, defaults to color. 1146 // Test that the color settings, two options, both custom, defaults to color.
1187 TEST_F('PrintPreviewWebUITest', 1147 TEST_F('PrintPreviewWebUITest',
1188 'TestColorSettingsBothCustomDefaultColor', function() { 1148 'TestColorSettingsBothCustomDefaultColor', function() {
1189 this.setInitialSettings(); 1149 this.setInitialSettings();
1190 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 1150 this.nativeLayer_.whenCalled('getInitialSettings').then(
1191 function() { 1151 function() {
1192 this.setLocalDestinations(); 1152 this.setLocalDestinations();
1193 1153
1194 var device = getCddTemplate("FooDevice"); 1154 var device = getCddTemplate("FooDevice");
1195 device.capabilities.printer.color = { 1155 device.capabilities.printer.color = {
1196 "option": [ 1156 "option": [
1197 {"type": "CUSTOM_MONOCHROME", "vendor_id": "42"}, 1157 {"type": "CUSTOM_MONOCHROME", "vendor_id": "42"},
1198 {"is_default": true, "type": "CUSTOM_COLOR", "vendor_id": "43"} 1158 {"is_default": true, "type": "CUSTOM_COLOR", "vendor_id": "43"}
1199 ] 1159 ]
1200 }; 1160 };
1201 this.setCapabilities(device); 1161 this.setCapabilities(device);
1202 1162
1203 checkSectionVisible($('color-settings'), true); 1163 checkSectionVisible($('color-settings'), true);
1204 expectEquals( 1164 expectEquals(
1205 'color', 1165 'color',
1206 $('color-settings').querySelector('.color-settings-select').value); 1166 $('color-settings').querySelector('.color-settings-select').value);
1207 1167
1208 this.waitForAnimationToEnd('more-settings'); 1168 this.waitForAnimationToEnd('more-settings');
1209 }.bind(this)); 1169 }.bind(this));
1210 }); 1170 });
1211 1171
1212 // Test to verify that duplex settings are set according to the printer 1172 // Test to verify that duplex settings are set according to the printer
1213 // capabilities. 1173 // capabilities.
1214 TEST_F('PrintPreviewWebUITest', 'TestDuplexSettingsTrue', function() { 1174 TEST_F('PrintPreviewWebUITest', 'TestDuplexSettingsTrue', function() {
1215 this.setInitialSettings(); 1175 this.setInitialSettings();
1216 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 1176 this.nativeLayer_.whenCalled('getInitialSettings').then(
1217 function() { 1177 function() {
1218 this.setLocalDestinations(); 1178 this.setLocalDestinations();
1219 this.setCapabilities(getCddTemplate("FooDevice")); 1179 this.setCapabilities(getCddTemplate("FooDevice"));
1220 1180
1221 var otherOptions = $('other-options-settings'); 1181 var otherOptions = $('other-options-settings');
1222 checkSectionVisible(otherOptions, true); 1182 checkSectionVisible(otherOptions, true);
1223 duplexContainer = otherOptions.querySelector('#duplex-container'); 1183 duplexContainer = otherOptions.querySelector('#duplex-container');
1224 expectFalse(duplexContainer.hidden); 1184 expectFalse(duplexContainer.hidden);
1225 expectFalse(duplexContainer.querySelector('.checkbox').checked); 1185 expectFalse(duplexContainer.querySelector('.checkbox').checked);
1226 1186
1227 this.waitForAnimationToEnd('more-settings'); 1187 this.waitForAnimationToEnd('more-settings');
1228 }.bind(this)); 1188 }.bind(this));
1229 }); 1189 });
1230 1190
1231 // Test to verify that duplex settings are set according to the printer 1191 // Test to verify that duplex settings are set according to the printer
1232 // capabilities. 1192 // capabilities.
1233 TEST_F('PrintPreviewWebUITest', 'TestDuplexSettingsFalse', function() { 1193 TEST_F('PrintPreviewWebUITest', 'TestDuplexSettingsFalse', function() {
1234 this.setInitialSettings(); 1194 this.setInitialSettings();
1235 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 1195 this.nativeLayer_.whenCalled('getInitialSettings').then(
1236 function() { 1196 function() {
1237 this.setLocalDestinations(); 1197 this.setLocalDestinations();
1238 var device = getCddTemplate("FooDevice"); 1198 var device = getCddTemplate("FooDevice");
1239 delete device.capabilities.printer.duplex; 1199 delete device.capabilities.printer.duplex;
1240 this.setCapabilities(device); 1200 this.setCapabilities(device);
1241 1201
1242 // Check that it is collapsed. 1202 // Check that it is collapsed.
1243 var otherOptions = $('other-options-settings'); 1203 var otherOptions = $('other-options-settings');
1244 checkSectionVisible(otherOptions, false); 1204 checkSectionVisible(otherOptions, false);
1245 1205
1246 this.expandMoreSettings(); 1206 this.expandMoreSettings();
1247 1207
1248 // Now it should be visible. 1208 // Now it should be visible.
1249 checkSectionVisible(otherOptions, true); 1209 checkSectionVisible(otherOptions, true);
1250 expectTrue(otherOptions.querySelector('#duplex-container').hidden); 1210 expectTrue(otherOptions.querySelector('#duplex-container').hidden);
1251 1211
1252 this.waitForAnimationToEnd('more-settings'); 1212 this.waitForAnimationToEnd('more-settings');
1253 }.bind(this)); 1213 }.bind(this));
1254 }); 1214 });
1255 1215
1256 // Test that changing the selected printer updates the preview. 1216 // Test that changing the selected printer updates the preview.
1257 TEST_F('PrintPreviewWebUITest', 'TestPrinterChangeUpdatesPreview', function() { 1217 TEST_F('PrintPreviewWebUITest', 'TestPrinterChangeUpdatesPreview', function() {
1258 this.setInitialSettings(); 1218 this.setInitialSettings();
1259 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 1219 this.nativeLayer_.whenCalled('getInitialSettings').then(
1260 function() { 1220 function() {
1261 this.setLocalDestinations(); 1221 this.setLocalDestinations();
1262 this.setCapabilities(getCddTemplate("FooDevice")); 1222 this.setCapabilities(getCddTemplate("FooDevice"));
1263 1223
1264 var previewGenerator = mock(print_preview.PreviewGenerator); 1224 var previewGenerator = mock(print_preview.PreviewGenerator);
1265 this.printPreview_.previewArea_.previewGenerator_ = 1225 this.previewArea_.previewGenerator_ =
1266 previewGenerator.proxy(); 1226 previewGenerator.proxy();
1267 1227
1268 // The number of settings that can change due to a change in the 1228 // The number of settings that can change due to a change in the
1269 // destination that will therefore dispatch ticket item change events. 1229 // destination that will therefore dispatch ticket item change events.
1270 previewGenerator.expects(exactly(9)).requestPreview(); 1230 previewGenerator.expects(exactly(9)).requestPreview();
1271 1231
1272 var barDestination = 1232 var barDestination =
1273 this.printPreview_.destinationStore_.destinations().find( 1233 this.printPreview_.destinationStore_.destinations().find(
1274 function(d) { 1234 function(d) {
1275 return d.id == 'BarDevice'; 1235 return d.id == 'BarDevice';
1276 }); 1236 });
1277 1237
1278 this.printPreview_.destinationStore_.selectDestination(barDestination); 1238 this.printPreview_.destinationStore_.selectDestination(barDestination);
1279 1239
1280 var device = getCddTemplate("BarDevice"); 1240 var device = getCddTemplate("BarDevice");
1281 device.capabilities.printer.color = { 1241 device.capabilities.printer.color = {
1282 "option": [ 1242 "option": [
1283 {"is_default": true, "type": "STANDARD_MONOCHROME"} 1243 {"is_default": true, "type": "STANDARD_MONOCHROME"}
1284 ] 1244 ]
1285 }; 1245 };
1286 this.setCapabilities(device); 1246 this.setCapabilities(device);
1287 1247
1288 this.waitForAnimationToEnd('more-settings'); 1248 this.waitForAnimationToEnd('more-settings');
1289 }.bind(this)); 1249 }.bind(this));
1290 }); 1250 });
1291 1251
1292 // Test that error message is displayed when plugin doesn't exist. 1252 // Test that error message is displayed when plugin doesn't exist.
1293 TEST_F('PrintPreviewWebUITest', 'TestNoPDFPluginErrorMessage', function() { 1253 TEST_F('PrintPreviewWebUITest', 'TestNoPDFPluginErrorMessage', function() {
1294 this.setInitialSettings(); 1254 this.setInitialSettings();
1295 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 1255 this.nativeLayer_.whenCalled('getInitialSettings').then(
1296 function() { 1256 function() {
1297 var previewAreaEl = $('preview-area'); 1257 var previewAreaEl = $('preview-area');
1298 1258
1299 var loadingMessageEl = 1259 var loadingMessageEl =
1300 previewAreaEl. 1260 previewAreaEl.
1301 getElementsByClassName('preview-area-loading-message')[0]; 1261 getElementsByClassName('preview-area-loading-message')[0];
1302 expectTrue(loadingMessageEl.hidden); 1262 expectTrue(loadingMessageEl.hidden);
1303 1263
1304 var previewFailedMessageEl = previewAreaEl.getElementsByClassName( 1264 var previewFailedMessageEl = previewAreaEl.getElementsByClassName(
1305 'preview-area-preview-failed-message')[0]; 1265 'preview-area-preview-failed-message')[0];
1306 expectTrue(previewFailedMessageEl.hidden); 1266 expectTrue(previewFailedMessageEl.hidden);
1307 1267
1308 var printFailedMessageEl = 1268 var printFailedMessageEl =
1309 previewAreaEl. 1269 previewAreaEl.
1310 getElementsByClassName('preview-area-print-failed')[0]; 1270 getElementsByClassName('preview-area-print-failed')[0];
1311 expectTrue(printFailedMessageEl.hidden); 1271 expectTrue(printFailedMessageEl.hidden);
1312 1272
1313 var customMessageEl = 1273 var customMessageEl =
1314 previewAreaEl. 1274 previewAreaEl.
1315 getElementsByClassName('preview-area-custom-message')[0]; 1275 getElementsByClassName('preview-area-custom-message')[0];
1316 expectFalse(customMessageEl.hidden); 1276 expectFalse(customMessageEl.hidden);
1317 1277
1318 testDone(); 1278 testDone();
1319 }); 1279 });
1320 }); 1280 });
1321 1281
1322 // Test custom localized paper names. 1282 // Test custom localized paper names.
1323 TEST_F('PrintPreviewWebUITest', 'TestCustomPaperNames', function() { 1283 TEST_F('PrintPreviewWebUITest', 'TestCustomPaperNames', function() {
1324 this.setInitialSettings(); 1284 this.setInitialSettings();
1325 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 1285 this.nativeLayer_.whenCalled('getInitialSettings').then(
1326 function() { 1286 function() {
1327 this.setLocalDestinations(); 1287 this.setLocalDestinations();
1328 1288
1329 var customLocalizedMediaName = 'Vendor defined localized media name'; 1289 var customLocalizedMediaName = 'Vendor defined localized media name';
1330 var customMediaName = 'Vendor defined media name'; 1290 var customMediaName = 'Vendor defined media name';
1331 1291
1332 var device = getCddTemplate("FooDevice"); 1292 var device = getCddTemplate("FooDevice");
1333 device.capabilities.printer.media_size = { 1293 device.capabilities.printer.media_size = {
1334 option: [ 1294 option: [
1335 { name: 'CUSTOM', 1295 { name: 'CUSTOM',
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1441 advancedOptionsSettingsButton.disabled = false; 1401 advancedOptionsSettingsButton.disabled = false;
1442 advancedOptionsSettingsButton.click(); 1402 advancedOptionsSettingsButton.click();
1443 } 1403 }
1444 1404
1445 // Test advanced settings with 1 capability (should not display settings search 1405 // Test advanced settings with 1 capability (should not display settings search
1446 // box). 1406 // box).
1447 TEST_F('PrintPreviewWebUITest', 'TestAdvancedSettings1Option', function() { 1407 TEST_F('PrintPreviewWebUITest', 'TestAdvancedSettings1Option', function() {
1448 var device = getCddTemplateWithAdvancedSettings("FooDevice"); 1408 var device = getCddTemplateWithAdvancedSettings("FooDevice");
1449 this.accessibilityIssuesAreErrors = false; 1409 this.accessibilityIssuesAreErrors = false;
1450 this.setInitialSettings(); 1410 this.setInitialSettings();
1451 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 1411 this.nativeLayer_.whenCalled('getInitialSettings').then(
1452 function() { 1412 function() {
1453 this.setupAdvancedSettingsTest(device); 1413 this.setupAdvancedSettingsTest(device);
1454 1414
1455 // Open the advanced settings overlay. 1415 // Open the advanced settings overlay.
1456 openAdvancedSettings(); 1416 openAdvancedSettings();
1457 1417
1458 // Check that advanced settings close button is now visible, 1418 // Check that advanced settings close button is now visible,
1459 // but not the search box (only 1 capability). 1419 // but not the search box (only 1 capability).
1460 var advancedSettingsCloseButton = $('advanced-settings'). 1420 var advancedSettingsCloseButton = $('advanced-settings').
1461 querySelector('.close-button'); 1421 querySelector('.close-button');
(...skipping 17 matching lines...) Expand all
1479 select_cap: { 1439 select_cap: {
1480 option: [ 1440 option: [
1481 {display_name: 'Standard', value: 0, is_default: true}, 1441 {display_name: 'Standard', value: 0, is_default: true},
1482 {display_name: 'Recycled', value: 1}, 1442 {display_name: 'Recycled', value: 1},
1483 {display_name: 'Special', value: 2} 1443 {display_name: 'Special', value: 2}
1484 ] 1444 ]
1485 } 1445 }
1486 }); 1446 });
1487 this.accessibilityIssuesAreErrors = false; 1447 this.accessibilityIssuesAreErrors = false;
1488 this.setInitialSettings(); 1448 this.setInitialSettings();
1489 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 1449 this.nativeLayer_.whenCalled('getInitialSettings').then(
1490 function() { 1450 function() {
1491 this.setupAdvancedSettingsTest(device); 1451 this.setupAdvancedSettingsTest(device);
1492 1452
1493 // Open the advanced settings overlay. 1453 // Open the advanced settings overlay.
1494 openAdvancedSettings(); 1454 openAdvancedSettings();
1495 1455
1496 // Check advanced settings is visible and that the search box now 1456 // Check advanced settings is visible and that the search box now
1497 // appears. 1457 // appears.
1498 var advancedSettingsCloseButton = $('advanced-settings'). 1458 var advancedSettingsCloseButton = $('advanced-settings').
1499 querySelector('.close-button'); 1459 querySelector('.close-button');
(...skipping 20 matching lines...) Expand all
1520 extensionId: '', extensionName: '' 1480 extensionId: '', extensionName: ''
1521 }; 1481 };
1522 }), 1482 }),
1523 }; 1483 };
1524 this.initialSettings_.serializedAppStateStr_ = JSON.stringify(initSettings); 1484 this.initialSettings_.serializedAppStateStr_ = JSON.stringify(initSettings);
1525 this.setCapabilities(getCddTemplate('ID1')); 1485 this.setCapabilities(getCddTemplate('ID1'));
1526 this.setCapabilities(getCddTemplate('ID2')); 1486 this.setCapabilities(getCddTemplate('ID2'));
1527 this.setCapabilities(getCddTemplate('ID3')); 1487 this.setCapabilities(getCddTemplate('ID3'));
1528 1488
1529 // Use a real preview generator. 1489 // Use a real preview generator.
1530 this.printPreview_.previewArea_.previewGenerator_ = 1490 this.previewArea_.previewGenerator_ =
1531 new print_preview.PreviewGenerator(this.printPreview_.destinationStore_, 1491 new print_preview.PreviewGenerator(this.printPreview_.destinationStore_,
1532 this.printPreview_.printTicketStore_, this.nativeLayer_, 1492 this.printPreview_.printTicketStore_, this.nativeLayer_,
1533 this.printPreview_.documentInfo_); 1493 this.printPreview_.documentInfo_);
1534 1494
1535 // Preview generator starts out with inFlightRequestId_ == -1. The id 1495 // Preview generator starts out with inFlightRequestId_ == -1. The id
1536 // increments by 1 for each startGetPreview call it makes. It should only 1496 // increments by 1 for each startGetPreview call it makes. It should only
1537 // make one such call during initialization or there will be a race; see 1497 // make one such call during initialization or there will be a race; see
1538 // crbug.com/666595 1498 // crbug.com/666595
1539 expectEquals( 1499 expectEquals(
1540 -1, 1500 -1,
1541 this.printPreview_.previewArea_.previewGenerator_.inFlightRequestId_); 1501 this.previewArea_.previewGenerator_.inFlightRequestId_);
1542 this.setInitialSettings(); 1502 this.setInitialSettings();
1543 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 1503 this.nativeLayer_.whenCalled('getInitialSettings').then(
1544 function() { 1504 function() {
1545 expectEquals( 1505 expectEquals(
1546 0, 1506 0,
1547 this.printPreview_.previewArea_.previewGenerator_. 1507 this.previewArea_.previewGenerator_.
1548 inFlightRequestId_); 1508 inFlightRequestId_);
1549 testDone(); 1509 testDone();
1550 }.bind(this)); 1510 }.bind(this));
1551 }); 1511 });
1552 1512
1553 // Test that invalid settings errors disable the print preview and display 1513 // Test that invalid settings errors disable the print preview and display
1554 // an error and that the preview dialog can be recovered by selecting a 1514 // an error and that the preview dialog can be recovered by selecting a
1555 // new destination. 1515 // new destination.
1556 TEST_F('PrintPreviewWebUITest', 'TestInvalidSettingsError', function() { 1516 TEST_F('PrintPreviewWebUITest', 'TestInvalidSettingsError', function() {
1557 // Setup 1517 // Setup
1558 this.setInitialSettings(); 1518 this.setInitialSettings();
1559 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 1519 this.nativeLayer_.whenCalled('getInitialSettings').then(
1560 function() { 1520 function() {
1561 this.setLocalDestinations(); 1521 this.setLocalDestinations();
1562 this.setCapabilities(getCddTemplate("FooDevice")); 1522 this.setCapabilities(getCddTemplate("FooDevice"));
1563 1523
1564 // Manually enable the print header. This is needed since there is no 1524 // Manually enable the print header. This is needed since there is no
1565 // plugin during test, so it will be set as disabled normally. 1525 // plugin during test, so it will be set as disabled normally.
1566 this.printPreview_.printHeader_.isEnabled = true; 1526 this.printPreview_.printHeader_.isEnabled = true;
1567 1527
1568 // There will be an error message in the preview area since the plugin 1528 // There will be an error message in the preview area since the plugin
1569 // is not running. However, it should not be the invalid settings error. 1529 // is not running. However, it should not be the invalid settings error.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 testDone(); 1574 testDone();
1615 }.bind(this)); 1575 }.bind(this));
1616 }); 1576 });
1617 1577
1618 // Test the preview generator to make sure the generate draft parameter is set 1578 // Test the preview generator to make sure the generate draft parameter is set
1619 // correctly. It should be false if the only change is the page range. 1579 // correctly. It should be false if the only change is the page range.
1620 TEST_F('PrintPreviewWebUITest', 'TestGenerateDraft', function() { 1580 TEST_F('PrintPreviewWebUITest', 'TestGenerateDraft', function() {
1621 this.createPrintPreview(); 1581 this.createPrintPreview();
1622 1582
1623 // Use a real preview generator. 1583 // Use a real preview generator.
1624 this.printPreview_.previewArea_.previewGenerator_ = 1584 this.previewArea_.previewGenerator_ =
1625 new print_preview.PreviewGenerator(this.printPreview_.destinationStore_, 1585 new print_preview.PreviewGenerator(this.printPreview_.destinationStore_,
1626 this.printPreview_.printTicketStore_, this.nativeLayer_, 1586 this.printPreview_.printTicketStore_, this.nativeLayer_,
1627 this.printPreview_.documentInfo_); 1587 this.printPreview_.documentInfo_);
1628 1588
1629 this.setInitialSettings(); 1589 this.setInitialSettings();
1630 this.printPreview_.nativeLayer_.whenCalled('getInitialSettings').then( 1590 this.nativeLayer_.whenCalled('getInitialSettings').then(
1631 function() { 1591 function() {
1632 this.setLocalDestinations(); 1592 this.setLocalDestinations();
1633 this.setCapabilities(getCddTemplate("FooDevice")); 1593 this.setCapabilities(getCddTemplate("FooDevice"));
1634 1594
1635 // The first request should generate draft because there was no 1595 // The first request should generate draft because there was no
1636 // previous print preview draft. 1596 // previous print preview draft.
1637 expectTrue(this.generateDraft()); 1597 expectTrue(this.generateDraft());
1638 1598
1639 // Change the page range - no new draft needed. 1599 // Change the page range - no new draft needed.
1640 this.printPreview_.printTicketStore_.pageRange.updateValue("2"); 1600 this.printPreview_.printTicketStore_.pageRange.updateValue("2");
1641 expectFalse(this.generateDraft()); 1601 expectFalse(this.generateDraft());
1642 1602
1643 // Change the margin type - need to regenerate again. 1603 // Change the margin type - need to regenerate again.
1644 this.printPreview_.printTicketStore_.marginsType.updateValue( 1604 this.printPreview_.printTicketStore_.marginsType.updateValue(
1645 print_preview.ticket_items.MarginsTypeValue.NO_MARGINS); 1605 print_preview.ticket_items.MarginsTypeValue.NO_MARGINS);
1646 expectTrue(this.generateDraft()); 1606 expectTrue(this.generateDraft());
1647 1607
1648 testDone(); 1608 testDone();
1649 }.bind(this)); 1609 }.bind(this));
1650 }); 1610 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698