OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 'use strict'; | 4 'use strict'; |
5 | 5 |
6 /** | 6 /** |
7 * Test target. | 7 * Test target. |
8 * @type {DeviceHandler} | 8 * @type {DeviceHandler} |
9 */ | 9 */ |
10 var handler; | 10 var handler; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 } | 159 } |
160 }); | 160 }); |
161 // Should do nothing this time. | 161 // Should do nothing this time. |
162 assertEquals(0, Object.keys(chrome.notifications.items).length); | 162 assertEquals(0, Object.keys(chrome.notifications.items).length); |
163 } | 163 } |
164 | 164 |
165 function testUnsupportedDevice() { | 165 function testUnsupportedDevice() { |
166 registerTypicalDevice(); | 166 registerTypicalDevice(); |
167 | 167 |
168 chrome.fileBrowserPrivate.onMountCompleted.dispatch({ | 168 chrome.fileBrowserPrivate.onMountCompleted.dispatch({ |
169 status: 'error_unsuported_filesystem', | 169 status: 'error_unsupported_filesystem', |
170 volumeMetadata: { | 170 volumeMetadata: { |
171 isParentDevice: false, | 171 isParentDevice: false, |
172 deviceType: 'usb', | 172 deviceType: 'usb', |
173 devicePath: '/device/path', | 173 devicePath: '/device/path', |
174 deviceLabel: 'label' | 174 deviceLabel: 'label' |
175 } | 175 } |
176 }); | 176 }); |
177 assertFalse(!!chrome.notifications.items['device:/device/path']); | 177 assertFalse(!!chrome.notifications.items['device:/device/path']); |
178 assertEquals( | 178 assertEquals( |
179 'DEVICE_UNSUPPORTED: label', | 179 'DEVICE_UNSUPPORTED: label', |
(...skipping 10 matching lines...) Expand all Loading... |
190 deviceType: 'usb', | 190 deviceType: 'usb', |
191 devicePath: '/device/path', | 191 devicePath: '/device/path', |
192 deviceLabel: 'label' | 192 deviceLabel: 'label' |
193 } | 193 } |
194 }); | 194 }); |
195 assertEquals( | 195 assertEquals( |
196 'DEVICE_UNKNOWN: label', | 196 'DEVICE_UNKNOWN: label', |
197 chrome.notifications.items['deviceFail:/device/path'].message); | 197 chrome.notifications.items['deviceFail:/device/path'].message); |
198 | 198 |
199 chrome.fileBrowserPrivate.onMountCompleted.dispatch({ | 199 chrome.fileBrowserPrivate.onMountCompleted.dispatch({ |
200 status: 'error_unsuported_filesystem', | 200 status: 'error_unsupported_filesystem', |
201 volumeMetadata: { | 201 volumeMetadata: { |
202 isParentDevice: false, | 202 isParentDevice: false, |
203 deviceType: 'usb', | 203 deviceType: 'usb', |
204 devicePath: '/device/path', | 204 devicePath: '/device/path', |
205 deviceLabel: 'label' | 205 deviceLabel: 'label' |
206 } | 206 } |
207 }); | 207 }); |
208 assertEquals(1, Object.keys(chrome.notifications.items).length); | 208 assertEquals(1, Object.keys(chrome.notifications.items).length); |
209 assertEquals( | 209 assertEquals( |
210 'DEVICE_UNSUPPORTED: label', | 210 'DEVICE_UNSUPPORTED: label', |
211 chrome.notifications.items['deviceFail:/device/path'].message); | 211 chrome.notifications.items['deviceFail:/device/path'].message); |
212 } | 212 } |
213 | 213 |
214 function testMountPartialSuccess() { | 214 function testMountPartialSuccess() { |
215 registerTypicalDevice(); | 215 registerTypicalDevice(); |
216 | 216 |
217 chrome.fileBrowserPrivate.onMountCompleted.dispatch({ | 217 chrome.fileBrowserPrivate.onMountCompleted.dispatch({ |
218 status: 'success', | 218 status: 'success', |
219 volumeMetadata: { | 219 volumeMetadata: { |
220 isParentDevice: false, | 220 isParentDevice: false, |
221 deviceType: 'usb', | 221 deviceType: 'usb', |
222 devicePath: '/device/path', | 222 devicePath: '/device/path', |
223 deviceLabel: 'label' | 223 deviceLabel: 'label' |
224 } | 224 } |
225 }); | 225 }); |
226 assertEquals(0, Object.keys(chrome.notifications.items).length); | 226 assertEquals(0, Object.keys(chrome.notifications.items).length); |
227 | 227 |
228 chrome.fileBrowserPrivate.onMountCompleted.dispatch({ | 228 chrome.fileBrowserPrivate.onMountCompleted.dispatch({ |
229 status: 'error_unsuported_filesystem', | 229 status: 'error_unsupported_filesystem', |
230 volumeMetadata: { | 230 volumeMetadata: { |
231 isParentDevice: false, | 231 isParentDevice: false, |
232 deviceType: 'usb', | 232 deviceType: 'usb', |
233 devicePath: '/device/path', | 233 devicePath: '/device/path', |
234 deviceLabel: 'label' | 234 deviceLabel: 'label' |
235 } | 235 } |
236 }); | 236 }); |
237 assertEquals(1, Object.keys(chrome.notifications.items).length); | 237 assertEquals(1, Object.keys(chrome.notifications.items).length); |
238 assertEquals( | 238 assertEquals( |
239 'MULTIPART_DEVICE_UNSUPPORTED: label', | 239 'MULTIPART_DEVICE_UNSUPPORTED: label', |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 function testDeviceHardUnplugged() { | 415 function testDeviceHardUnplugged() { |
416 chrome.fileBrowserPrivate.onDeviceChanged.dispatch({ | 416 chrome.fileBrowserPrivate.onDeviceChanged.dispatch({ |
417 type: 'hard_unplugged', | 417 type: 'hard_unplugged', |
418 devicePath: '/device/path' | 418 devicePath: '/device/path' |
419 }); | 419 }); |
420 assertEquals(1, Object.keys(chrome.notifications.items).length); | 420 assertEquals(1, Object.keys(chrome.notifications.items).length); |
421 assertEquals('DEVICE_HARD_UNPLUGGED_MESSAGE', | 421 assertEquals('DEVICE_HARD_UNPLUGGED_MESSAGE', |
422 chrome.notifications.items[ | 422 chrome.notifications.items[ |
423 'hardUnplugged:/device/path'].message); | 423 'hardUnplugged:/device/path'].message); |
424 } | 424 } |
OLD | NEW |