| OLD | NEW |
| 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 Loading... |
| 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 if (cr.isChromeOS) { |
| 220 var destId = '00112233DEADBEEF'; | 219 // The 'ResolutionFails' test covers this case for non-CrOS. |
| 220 test('ReceiveFailedSetup', function() { |
| 221 var destId = '00112233DEADBEEF'; |
| 221 | 222 |
| 222 var resolver = mockSetupCall(destId, nativeLayer_); | 223 var resolver = mockSetupCall(destId, nativeLayer_); |
| 223 requestSetup(destId, destinationSearch_); | 224 requestSetup(destId, destinationSearch_); |
| 224 | 225 |
| 225 // Force resolution to fail. | 226 // Force resolution to fail. |
| 226 resolveSetup(resolver, destId, false, null); | 227 resolveSetup(resolver, destId, false, null); |
| 227 | 228 |
| 228 if (cr.isChromeOS) { | |
| 229 // Selection should not change on ChromeOS. | 229 // Selection should not change on ChromeOS. |
| 230 assertEquals(null, destinationStore_.selectedDestination); | 230 assertEquals(null, destinationStore_.selectedDestination); |
| 231 } else { | 231 }); |
| 232 // Other code expects selection to be present so it still occurs | 232 } |
| 233 // for non-CrOS. | |
| 234 assertEquals(destId, destinationStore_.selectedDestination.id); | |
| 235 } | |
| 236 }); | |
| 237 }); | 233 }); |
| 238 | 234 |
| 239 mocha.run(); | 235 mocha.run(); |
| 240 }); | 236 }); |
| OLD | NEW |