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

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

Issue 2969383003: Print Preview: Finish removing global Javascript functions. (Closed)
Patch Set: Move listener addition Created 3 years, 5 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 GEN_INCLUDE( 7 GEN_INCLUDE(
8 [ROOT_PATH + 'chrome/test/data/webui/polymer_browser_test_base.js']); 8 [ROOT_PATH + 'chrome/test/data/webui/polymer_browser_test_base.js']);
9 9
10 /** 10 /**
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 // Select destination. 118 // Select destination.
119 if (cr.isChromeOS) { 119 if (cr.isChromeOS) {
120 destinationSearch.handleConfigureDestination_(dest); 120 destinationSearch.handleConfigureDestination_(dest);
121 } else { 121 } else {
122 destinationSearch.handleOnDestinationSelect_(dest); 122 destinationSearch.handleOnDestinationSelect_(dest);
123 } 123 }
124 }; 124 };
125 125
126 setup(function() { 126 setup(function() {
127 Mock4JS.clearMocksToVerify(); 127 Mock4JS.clearMocksToVerify();
dpapad 2017/07/07 21:12:41 Can we delete this now? Or is it still used?
rbpotter 2017/07/07 23:58:39 Done. Appears there are no other mocks. Also remo
128 nativeLayer_ = new print_preview.NativeLayerStub(); 128 nativeLayer_ = new print_preview.NativeLayerStub();
129 var nativeLayerEventTarget = mock(cr.EventTarget);
130 nativeLayer_.setEventTarget(nativeLayerEventTarget.proxy());
131 nativeLayerEventTarget.expects(atLeastOnce())
132 .addEventListener(ANYTHING, ANYTHING, ANYTHING);
133
134 invitationStore_ = new print_preview.InvitationStore(); 129 invitationStore_ = new print_preview.InvitationStore();
135 destinationStore_ = new print_preview.DestinationStore( 130 destinationStore_ = new print_preview.DestinationStore(
136 nativeLayer_, new print_preview.UserInfo(), 131 nativeLayer_, new print_preview.UserInfo(),
137 new print_preview.AppState()); 132 new print_preview.AppState());
138 userInfo_ = new print_preview.UserInfo(); 133 userInfo_ = new print_preview.UserInfo();
139 134
140 destinationSearch_ = new print_preview.DestinationSearch( 135 destinationSearch_ = new print_preview.DestinationSearch(
141 destinationStore_, invitationStore_, userInfo_); 136 destinationStore_, invitationStore_, userInfo_);
142 destinationSearch_.decorate($('destination-search')); 137 destinationSearch_.decorate($('destination-search'));
143 }); 138 });
144 139
145 teardown(function() { 140 teardown(function() {
146 Mock4JS.verifyAllMocks(); 141 Mock4JS.verifyAllMocks();
147 }); 142 });
148 143
149 test('ResolutionFails', function() { 144 test('ResolutionFails', function() {
150 var destId = "001122DEADBEEF"; 145 var destId = "001122DEADBEEF";
151 if (cr.isChromeOS) { 146 if (cr.isChromeOS) {
dpapad 2017/07/07 21:12:41 Same question here.
rbpotter 2017/07/07 23:58:39 This is still used to distinguish ChromeOS (which
152 nativeLayer_.setSetupPrinterResponse(true, { printerId: destId, 147 nativeLayer_.setSetupPrinterResponse(true, { printerId: destId,
153 success: false,}); 148 success: false,});
154 } else { 149 } else {
155 nativeLayer_.setLocalDestinationCapabilities({printerId: destId, 150 nativeLayer_.setLocalDestinationCapabilities({printerId: destId,
156 capabilities: getCaps()}, 151 capabilities: getCaps()},
157 true); 152 true);
158 } 153 }
159 requestSetup(destId, destinationSearch_); 154 requestSetup(destId, destinationSearch_);
160 var callback = cr.isChromeOS ? 'setupPrinter' : 'getPrinterCapabilities'; 155 var callback = cr.isChromeOS ? 'setupPrinter' : 'getPrinterCapabilities';
161 return nativeLayer_.whenCalled(callback).then( 156 return nativeLayer_.whenCalled(callback).then(
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 // Simulate a click. 223 // Simulate a click.
229 dest.onActivate_(); 224 dest.onActivate_();
230 225
231 // Verify that the destination has been selected. 226 // Verify that the destination has been selected.
232 assertEquals(printerId, destinationStore_.selectedDestination.id); 227 assertEquals(printerId, destinationStore_.selectedDestination.id);
233 }); 228 });
234 }); 229 });
235 230
236 mocha.run(); 231 mocha.run();
237 }); 232 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698