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

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

Issue 2862203002: Print Preview: Fix data/ errors (Closed)
Patch Set: Fix destination resolver 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
« no previous file with comments | « chrome/browser/resources/print_preview/search/provisional_destination_resolver.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 var failEvent = new Event( 122 var failEvent = new Event(
123 print_preview.NativeLayer.EventType.GET_CAPABILITIES_FAIL); 123 print_preview.NativeLayer.EventType.GET_CAPABILITIES_FAIL);
124 failEvent.destinationId = destId; 124 failEvent.destinationId = destId;
125 destinationStore_.onGetCapabilitiesFail_(failEvent); 125 destinationStore_.onGetCapabilitiesFail_(failEvent);
126 }.bind(this)); 126 }.bind(this));
127 127
128 return resolver; 128 return resolver;
129 }; 129 };
130 130
131 function requestSetup(destId, destinationSearch) { 131 function requestSetup(destId, destinationSearch) {
132 var origin = cr.isChromeOS ? print_preview.Destination.Origin.CROS : 132 var origin = cr.isChromeOS ? print_preview.DestinationOrigin.CROS :
133 print_preview.Destination.Origin.LOCAL; 133 print_preview.DestinationOrigin.LOCAL;
134 134
135 var dest = new print_preview.Destination(destId, 135 var dest = new print_preview.Destination(destId,
136 print_preview.Destination.Type.LOCAL, 136 print_preview.DestinationType.LOCAL,
137 origin, 137 origin,
138 "displayName", 138 "displayName",
139 print_preview.Destination.ConnectionStatus.ONLINE); 139 print_preview.DestinationConnectionStatus.ONLINE);
140 140
141 // Add the destination to the list. 141 // Add the destination to the list.
142 destinationSearch.localList_.updateDestinations([dest]); 142 destinationSearch.localList_.updateDestinations([dest]);
143 143
144 // Select destination. 144 // Select destination.
145 if (cr.isChromeOS) { 145 if (cr.isChromeOS) {
146 destinationSearch.handleConfigureDestination_(dest); 146 destinationSearch.handleConfigureDestination_(dest);
147 } else { 147 } else {
148 destinationSearch.handleOnDestinationSelect_(dest); 148 destinationSearch.handleOnDestinationSelect_(dest);
149 } 149 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 // Selection should not change on ChromeOS. 223 // Selection should not change on ChromeOS.
224 assertEquals(null, destinationStore_.selectedDestination); 224 assertEquals(null, destinationStore_.selectedDestination);
225 }); 225 });
226 } 226 }
227 227
228 test('CloudKioskPrinter', function() { 228 test('CloudKioskPrinter', function() {
229 var printerId = 'cloud-printer-id'; 229 var printerId = 'cloud-printer-id';
230 230
231 // Create cloud destination. 231 // Create cloud destination.
232 var cloudDest = new print_preview.Destination(printerId, 232 var cloudDest = new print_preview.Destination(printerId,
233 print_preview.Destination.Type.GOOGLE, 233 print_preview.DestinationType.GOOGLE,
234 print_preview.Destination.Origin.DEVICE, 234 print_preview.DestinationOrigin.DEVICE,
235 "displayName", 235 "displayName",
236 print_preview.Destination.ConnectionStatus.ONLINE); 236 print_preview.DestinationConnectionStatus.ONLINE);
237 cloudDest.capabilities = getCaps(); 237 cloudDest.capabilities = getCaps();
238 238
239 // Place destination in the local list as happens for Kiosk printers. 239 // Place destination in the local list as happens for Kiosk printers.
240 destinationSearch_.localList_.updateDestinations([cloudDest]); 240 destinationSearch_.localList_.updateDestinations([cloudDest]);
241 var dest = destinationSearch_.localList_.getDestinationItem(printerId); 241 var dest = destinationSearch_.localList_.getDestinationItem(printerId);
242 // Simulate a click. 242 // Simulate a click.
243 dest.onActivate_(); 243 dest.onActivate_();
244 244
245 // Verify that the destination has been selected. 245 // Verify that the destination has been selected.
246 assertEquals(printerId, destinationStore_.selectedDestination.id); 246 assertEquals(printerId, destinationStore_.selectedDestination.id);
247 }); 247 });
248 }); 248 });
249 249
250 mocha.run(); 250 mocha.run();
251 }); 251 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/print_preview/search/provisional_destination_resolver.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698