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

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

Issue 2848093002: Process null capabilities as a capability fetch failure. (Closed)
Patch Set: refine assertions 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 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 } 189 }
190 190
191 var destId = "001122DEADBEEF"; 191 var destId = "001122DEADBEEF";
192 192
193 var resolver = mockSetupCall(destId, nativeLayer_); 193 var resolver = mockSetupCall(destId, nativeLayer_);
194 requestSetup(destId, destinationSearch_); 194 requestSetup(destId, destinationSearch_);
195 resolver.reject(destId); 195 resolver.reject(destId);
196 }); 196 });
197 197
198 test('ReceiveSuccessfulSetup', function() { 198 test('ReceiveSuccessfulSetup', function() {
199
200 var destId = "00112233DEADBEEF"; 199 var destId = "00112233DEADBEEF";
201 200
202 var waiter = waitForEvent( 201 var waiter = waitForEvent(
203 destinationStore_, 202 destinationStore_,
204 print_preview.DestinationStore.EventType.DESTINATION_SELECT); 203 print_preview.DestinationStore.EventType.DESTINATION_SELECT);
205 204
206 var resolver = mockSetupCall(destId, nativeLayer_); 205 var resolver = mockSetupCall(destId, nativeLayer_);
207 206
208 requestSetup(destId, destinationSearch_); 207 requestSetup(destId, destinationSearch_);
209 resolveSetup(resolver, destId, true, getCaps()); 208 resolveSetup(resolver, destId, true, getCaps());
210 209
211 // wait for event propogation to complete. 210 // wait for event propogation to complete.
212 return waiter.then(function() { 211 return waiter.then(function() {
213 // after setup succeeds, the destination should be selected. 212 // after setup succeeds, the destination should be selected.
214 assertNotEquals(null, destinationStore_.selectedDestination); 213 assertNotEquals(null, destinationStore_.selectedDestination);
215 assertEquals(destId, destinationStore_.selectedDestination.id); 214 assertEquals(destId, destinationStore_.selectedDestination.id);
216 }); 215 });
217 }); 216 });
218 217
219 test('ReceiveFailedSetup', function() { 218 test('ReceiveFailedSetup', function() {
dpapad 2017/05/02 00:07:41 if (cr.isChromeOS) { test('ReceiveFailedSetup',
skau 2017/05/02 01:52:48 Done.
219 if (!cr.isChromeOS) {
220 // The 'ResolutionFails' test covers this case for non-CrOS.
dpapad 2017/05/02 00:07:41 ResolutionFails test also returns early for non-Cr
skau 2017/05/02 01:52:48 The comment is accurate. The other test is disabl
221 return;
222 }
223
220 var destId = '00112233DEADBEEF'; 224 var destId = '00112233DEADBEEF';
221 225
222 var resolver = mockSetupCall(destId, nativeLayer_); 226 var resolver = mockSetupCall(destId, nativeLayer_);
223 requestSetup(destId, destinationSearch_); 227 requestSetup(destId, destinationSearch_);
224 228
225 // Force resolution to fail. 229 // Force resolution to fail.
226 resolveSetup(resolver, destId, false, null); 230 resolveSetup(resolver, destId, false, null);
227 231
228 if (cr.isChromeOS) { 232 // Selection should not change on ChromeOS.
229 // Selection should not change on ChromeOS. 233 assertEquals(null, destinationStore_.selectedDestination);
230 assertEquals(null, destinationStore_.selectedDestination);
231 } else {
232 // Other code expects selection to be present so it still occurs
233 // for non-CrOS.
234 assertEquals(destId, destinationStore_.selectedDestination.id);
235 }
236 }); 234 });
237 }); 235 });
238 236
239 mocha.run(); 237 mocha.run();
240 }); 238 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698