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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(); | |
128 nativeLayer_ = new print_preview.NativeLayerStub(); | 127 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(); | 128 invitationStore_ = new print_preview.InvitationStore(); |
135 destinationStore_ = new print_preview.DestinationStore( | 129 destinationStore_ = new print_preview.DestinationStore( |
136 nativeLayer_, new print_preview.UserInfo(), | 130 nativeLayer_, new print_preview.UserInfo(), |
137 new print_preview.AppState()); | 131 new print_preview.AppState()); |
138 userInfo_ = new print_preview.UserInfo(); | 132 userInfo_ = new print_preview.UserInfo(); |
139 | 133 |
140 destinationSearch_ = new print_preview.DestinationSearch( | 134 destinationSearch_ = new print_preview.DestinationSearch( |
141 destinationStore_, invitationStore_, userInfo_); | 135 destinationStore_, invitationStore_, userInfo_); |
142 destinationSearch_.decorate($('destination-search')); | 136 destinationSearch_.decorate($('destination-search')); |
143 }); | 137 }); |
144 | 138 |
145 teardown(function() { | |
146 Mock4JS.verifyAllMocks(); | |
147 }); | |
148 | |
149 test('ResolutionFails', function() { | 139 test('ResolutionFails', function() { |
150 var destId = "001122DEADBEEF"; | 140 var destId = "001122DEADBEEF"; |
151 if (cr.isChromeOS) { | 141 if (cr.isChromeOS) { |
152 nativeLayer_.setSetupPrinterResponse(true, { printerId: destId, | 142 nativeLayer_.setSetupPrinterResponse(true, { printerId: destId, |
153 success: false,}); | 143 success: false,}); |
154 } else { | 144 } else { |
155 nativeLayer_.setLocalDestinationCapabilities({printerId: destId, | 145 nativeLayer_.setLocalDestinationCapabilities({printerId: destId, |
156 capabilities: getCaps()}, | 146 capabilities: getCaps()}, |
157 true); | 147 true); |
158 } | 148 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 // Simulate a click. | 218 // Simulate a click. |
229 dest.onActivate_(); | 219 dest.onActivate_(); |
230 | 220 |
231 // Verify that the destination has been selected. | 221 // Verify that the destination has been selected. |
232 assertEquals(printerId, destinationStore_.selectedDestination.id); | 222 assertEquals(printerId, destinationStore_.selectedDestination.id); |
233 }); | 223 }); |
234 }); | 224 }); |
235 | 225 |
236 mocha.run(); | 226 mocha.run(); |
237 }); | 227 }); |
OLD | NEW |