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 var chrome; | 5 var chrome; |
6 | 6 |
7 loadTimeData.data = { | 7 loadTimeData.data = { |
8 DRIVE_DIRECTORY_LABEL: 'My Drive', | 8 DRIVE_DIRECTORY_LABEL: 'My Drive', |
9 DOWNLOADS_DIRECTORY_LABEL: 'Downloads' | 9 DOWNLOADS_DIRECTORY_LABEL: 'Downloads' |
10 }; | 10 }; |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 }), callback); | 206 }), callback); |
207 } | 207 } |
208 | 208 |
209 function testGetLocationInfo(callback) { | 209 function testGetLocationInfo(callback) { |
210 reportPromise(VolumeManager.getInstance().then(function(volumeManager) { | 210 reportPromise(VolumeManager.getInstance().then(function(volumeManager) { |
211 var downloadEntry = new MockFileEntry( | 211 var downloadEntry = new MockFileEntry( |
212 new MockFileSystem('download:Downloads'), | 212 new MockFileSystem('download:Downloads'), |
213 '/foo/bar/bla.zip'); | 213 '/foo/bar/bla.zip'); |
214 var downloadLocationInfo = volumeManager.getLocationInfo(downloadEntry); | 214 var downloadLocationInfo = volumeManager.getLocationInfo(downloadEntry); |
215 assertEquals(VolumeManagerCommon.VolumeType.DOWNLOADS, | 215 assertEquals(VolumeManagerCommon.VolumeType.DOWNLOADS, |
216 downloadLocationInfo.rootType) | 216 downloadLocationInfo.rootType); |
217 assertFalse(downloadLocationInfo.isReadOnly); | 217 assertFalse(downloadLocationInfo.isReadOnly); |
218 assertFalse(downloadLocationInfo.isRootEntry); | 218 assertFalse(downloadLocationInfo.isRootEntry); |
219 | 219 |
220 var driveEntry = new MockFileEntry( | 220 var driveEntry = new MockFileEntry( |
221 new MockFileSystem('drive:drive-foobar%40chromium.org-hash'), | 221 new MockFileSystem('drive:drive-foobar%40chromium.org-hash'), |
222 '/root'); | 222 '/root'); |
223 var driveLocationInfo = volumeManager.getLocationInfo(driveEntry); | 223 var driveLocationInfo = volumeManager.getLocationInfo(driveEntry); |
224 assertEquals(VolumeManagerCommon.VolumeType.DRIVE, | 224 assertEquals(VolumeManagerCommon.VolumeType.DRIVE, |
225 driveLocationInfo.rootType) | 225 driveLocationInfo.rootType); |
226 assertFalse(driveLocationInfo.isReadOnly); | 226 assertFalse(driveLocationInfo.isReadOnly); |
227 assertTrue(driveLocationInfo.isRootEntry); | 227 assertTrue(driveLocationInfo.isRootEntry); |
228 }), callback); | 228 }), callback); |
229 } | 229 } |
| 230 |
| 231 function testVolumeInfoListWhenReady(callback) { |
| 232 var list = new VolumeInfoList(); |
| 233 var promiseBeforeAdd = list.whenVolumeInfoReady('volumeId'); |
| 234 var volumeInfo = new VolumeInfo( |
| 235 /* volumeType */ null, |
| 236 'volumeId', |
| 237 /* fileSystem */ null, |
| 238 /* error */ null, |
| 239 /* deviceType */ null, |
| 240 /* devicePath */ null, |
| 241 /* isReadOnly */ false, |
| 242 /* profile */ {}, |
| 243 /* label */ null, |
| 244 /* extensionid */ null, |
| 245 /* hasMedia */ false); |
| 246 list.add(volumeInfo); |
| 247 var promiseAfterAdd = list.whenVolumeInfoReady('volumeId'); |
| 248 reportPromise(Promise.all([promiseBeforeAdd, promiseAfterAdd]).then( |
| 249 function(volumes) { |
| 250 assertEquals(volumeInfo, volumes[0]); |
| 251 assertEquals(volumeInfo, volumes[1]); |
| 252 }), callback); |
| 253 } |
OLD | NEW |