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 | 4 |
5 /** @type {!MockVolumeManager} */ | 5 /** @type {!MockVolumeManager} */ |
6 var volumeManager; | 6 var volumeManager; |
7 | 7 |
8 /** @type {!VolumeInfo} */ | 8 /** @type {!VolumeInfo} */ |
9 var cameraVolume; | 9 var cameraVolume; |
10 | 10 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
216 .then( | 216 .then( |
217 function() { | 217 function() { |
218 return importer.ChromeLocalStorage.getInstance() | 218 return importer.ChromeLocalStorage.getInstance() |
219 .get(importer.Setting.LAST_KNOWN_LOG_ID) | 219 .get(importer.Setting.LAST_KNOWN_LOG_ID) |
220 .then(assertEquals.bind(null, nextLogId)); | 220 .then(assertEquals.bind(null, nextLogId)); |
221 }); | 221 }); |
222 | 222 |
223 reportPromise(promise, callback); | 223 reportPromise(promise, callback); |
224 } | 224 } |
225 | 225 |
226 function testDeflateAppUrl() { | |
227 var url = 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj' + | |
228 '/external/removable/USB%20Drive/DCIM/derekkind2.jpg'; | |
229 var deflated = importer.deflateAppUrl(url); | |
230 | |
231 // Just verify that the string starts with our secret sauce marker... | |
232 assertTrue(deflated.substring(0, 1) === '$'); | |
mtomasz
2015/02/25 00:40:17
nit: assertEquals can be used for better logging.
Steve McKay
2015/02/25 01:51:56
Done.
| |
233 | |
234 // And that it is shorter than the original... | |
235 assertTrue(deflated.length < url.length); | |
236 | |
237 // And finally that we can reconstitute the original. | |
238 assertEquals(importer.inflateAppUrl(deflated), url); | |
mtomasz
2015/02/25 00:40:17
nit: Opposite order of arguments. Should be assert
Steve McKay
2015/02/25 01:51:56
Done.
| |
239 }; | |
240 | |
226 /** @param {string} path */ | 241 /** @param {string} path */ |
227 function assertIsMediaDir(path) { | 242 function assertIsMediaDir(path) { |
228 var dir = createDirectoryEntry(sdVolume, path); | 243 var dir = createDirectoryEntry(sdVolume, path); |
229 assertTrue(importer.isMediaDirectory(dir, volumeManager)); | 244 assertTrue(importer.isMediaDirectory(dir, volumeManager)); |
230 } | 245 } |
231 | 246 |
232 /** @param {string} path */ | 247 /** @param {string} path */ |
233 function assertIsNotMediaDir(path) { | 248 function assertIsNotMediaDir(path) { |
234 var dir = createDirectoryEntry(sdVolume, path); | 249 var dir = createDirectoryEntry(sdVolume, path); |
235 assertFalse(importer.isMediaDirectory(dir, volumeManager)); | 250 assertFalse(importer.isMediaDirectory(dir, volumeManager)); |
(...skipping 12 matching lines...) Expand all Loading... | |
248 return entry; | 263 return entry; |
249 } | 264 } |
250 | 265 |
251 function createDirectoryEntry(volume, path) { | 266 function createDirectoryEntry(volume, path) { |
252 var entry = new MockDirectoryEntry(volume.fileSystem, path); | 267 var entry = new MockDirectoryEntry(volume.fileSystem, path); |
253 // Ensure the file entry has a volumeID...necessary for lookups | 268 // Ensure the file entry has a volumeID...necessary for lookups |
254 // via the VolumeManager. | 269 // via the VolumeManager. |
255 entry.volumeId = volume.volumeId; | 270 entry.volumeId = volume.volumeId; |
256 return entry; | 271 return entry; |
257 } | 272 } |
OLD | NEW |