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

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

Issue 2865633004: Fix all remaining print preview closure compiler errors (Closed)
Patch Set: Address comments 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 GEN('#include "base/feature_list.h"'); 5 GEN('#include "base/feature_list.h"');
6 GEN('#include "chrome/common/chrome_features.h"'); 6 GEN('#include "chrome/common/chrome_features.h"');
7 7
8 /** 8 /**
9 * Test fixture for print preview WebUI testing. 9 * Test fixture for print preview WebUI testing.
10 * @constructor 10 * @constructor
11 * @extends {testing.Test} 11 * @extends {testing.Test}
12 */ 12 */
13 function PrintPreviewWebUITest() { 13 function PrintPreviewWebUITest() {
14 testing.Test.call(this); 14 testing.Test.call(this);
15 this.nativeLayer_ = null; 15 this.nativeLayer_ = null;
16 this.initialSettings_ = null; 16 this.initialSettings_ = null;
17 this.localDestinationInfos_ = null; 17 this.localDestinationInfos_ = null;
18 this.previewArea_ = null; 18 this.previewArea_ = null;
19 } 19 }
20 20
21 /** 21 /**
22 * Instance of PrintPreview for the test.
23 */
24 var printPreview;
25
26 /**
22 * Index of the "Save as PDF" printer. 27 * Index of the "Save as PDF" printer.
23 * @type {number} 28 * @type {number}
24 * @const 29 * @const
25 */ 30 */
26 PrintPreviewWebUITest.PDF_INDEX = 0; 31 PrintPreviewWebUITest.PDF_INDEX = 0;
27 32
28 /** 33 /**
29 * Index of the Foo printer. 34 * Index of the Foo printer.
30 * @type {number} 35 * @type {number}
31 * @const 36 * @const
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 }, 79 },
75 80
76 /** 81 /**
77 * Stub out low-level functionality like the NativeLayer and 82 * Stub out low-level functionality like the NativeLayer and
78 * CloudPrintInterface. 83 * CloudPrintInterface.
79 * @this {PrintPreviewWebUITest} 84 * @this {PrintPreviewWebUITest}
80 * @override 85 * @override
81 */ 86 */
82 preLoad: function() { 87 preLoad: function() {
83 window.addEventListener('DOMContentLoaded', function() { 88 window.addEventListener('DOMContentLoaded', function() {
89 print_preview.IsWebUITest = true;
dpapad 2017/05/08 23:39:48 We are adding a DOMContentLoaded handler here, and
rbpotter 2017/05/09 00:08:52 Done.
84 function NativeLayerStub() { 90 function NativeLayerStub() {
85 cr.EventTarget.call(this); 91 cr.EventTarget.call(this);
86 this.printStarted_ = false; 92 this.printStarted_ = false;
87 } 93 }
88 NativeLayerStub.prototype = { 94 NativeLayerStub.prototype = {
89 __proto__: cr.EventTarget.prototype, 95 __proto__: cr.EventTarget.prototype,
90 isPrintStarted: function() { return this.printStarted_; }, 96 isPrintStarted: function() { return this.printStarted_; },
91 previewReadyForTest: function() {}, 97 previewReadyForTest: function() {},
92 startGetInitialSettings: function() {}, 98 startGetInitialSettings: function() {},
93 startGetLocalDestinations: function() {}, 99 startGetLocalDestinations: function() {},
(...skipping 18 matching lines...) Expand all
112 search: function(isRecent) {} 118 search: function(isRecent) {}
113 }; 119 };
114 var oldCpInterfaceEventType = cloudprint.CloudPrintInterfaceEventType; 120 var oldCpInterfaceEventType = cloudprint.CloudPrintInterfaceEventType;
115 cloudprint.CloudPrintInterface = CloudPrintInterfaceStub; 121 cloudprint.CloudPrintInterface = CloudPrintInterfaceStub;
116 cloudprint.CloudPrintInterfaceEventType = oldCpInterfaceEventType; 122 cloudprint.CloudPrintInterfaceEventType = oldCpInterfaceEventType;
117 123
118 print_preview.PreviewArea.prototype.checkPluginCompatibility_ = 124 print_preview.PreviewArea.prototype.checkPluginCompatibility_ =
119 function() { 125 function() {
120 return false; 126 return false;
121 }; 127 };
128 printPreview = new print_preview.PrintPreview();
129 printPreview.initialize();
130
122 }.bind(this)); 131 }.bind(this));
123 }, 132 },
124 133
125 /** 134 /**
126 * Dispatch the INITIAL_SETTINGS_SET event. This call is NOT async and will 135 * Dispatch the INITIAL_SETTINGS_SET event. This call is NOT async and will
127 * happen in the same thread. 136 * happen in the same thread.
128 */ 137 */
129 setInitialSettings: function() { 138 setInitialSettings: function() {
130 var initialSettingsSetEvent = 139 var initialSettingsSetEvent =
131 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); 140 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET);
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 var scalingSettings = $('scaling-settings'); 628 var scalingSettings = $('scaling-settings');
620 629
621 // Check that options are collapsed (section is visible, because duplex is 630 // Check that options are collapsed (section is visible, because duplex is
622 // available). 631 // available).
623 checkSectionVisible(otherOptions, true); 632 checkSectionVisible(otherOptions, true);
624 checkElementDisplayed(fitToPage, false); 633 checkElementDisplayed(fitToPage, false);
625 if (isPrintAsImageEnabled()) 634 if (isPrintAsImageEnabled())
626 checkElementDisplayed(rasterize, false); 635 checkElementDisplayed(rasterize, false);
627 checkSectionVisible(mediaSize, false); 636 checkSectionVisible(mediaSize, false);
628 checkSectionVisible(scalingSettings, false); 637 checkSectionVisible(scalingSettings, false);
629
630 this.expandMoreSettings(); 638 this.expandMoreSettings();
631 639
632 checkElementDisplayed(fitToPage, false); 640 checkElementDisplayed(fitToPage, false);
633 if (isPrintAsImageEnabled()) 641 if (isPrintAsImageEnabled())
634 checkElementDisplayed(rasterize, false); 642 checkElementDisplayed(rasterize, false);
635 checkSectionVisible(mediaSize, true); 643 checkSectionVisible(mediaSize, true);
636 checkSectionVisible(scalingSettings, true); 644 checkSectionVisible(scalingSettings, true);
637
638 this.waitForAnimationToEnd('more-settings'); 645 this.waitForAnimationToEnd('more-settings');
639 }); 646 });
640 647
641 // When the source is "PDF", depending on the selected destination printer, we 648 // When the source is "PDF", depending on the selected destination printer, we
642 // show/hide the fit to page option and hide media size selection. 649 // show/hide the fit to page option and hide media size selection.
643 TEST_F('PrintPreviewWebUITest', 'SourceIsPDFCapabilities', function() { 650 TEST_F('PrintPreviewWebUITest', 'SourceIsPDFCapabilities', function() {
644 this.initialSettings_.isDocumentModifiable_ = false; 651 this.initialSettings_.isDocumentModifiable_ = false;
645 this.setInitialSettings(); 652 this.setInitialSettings();
646 this.setLocalDestinations(); 653 this.setLocalDestinations();
647 this.setCapabilities(getCddTemplate("FooDevice")); 654 this.setCapabilities(getCddTemplate("FooDevice"));
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 this.dispatchPreviewDone(); 1449 this.dispatchPreviewDone();
1443 1450
1444 // Has active print button and successfully "prints", indicating recovery 1451 // Has active print button and successfully "prints", indicating recovery
1445 // from error state. 1452 // from error state.
1446 expectFalse(printButton.disabled); 1453 expectFalse(printButton.disabled);
1447 expectFalse(this.hasPrinted()); 1454 expectFalse(this.hasPrinted());
1448 printButton.click(); 1455 printButton.click();
1449 expectTrue(this.hasPrinted()); 1456 expectTrue(this.hasPrinted());
1450 testDone(); 1457 testDone();
1451 }); 1458 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698