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 /** @const {!Event} */ | 5 /** @const {!Event} */ |
6 var EMPTY_EVENT = new Event('directory-changed'); | 6 var EMPTY_EVENT = new Event('directory-changed'); |
7 | 7 |
8 /** @type {!MockVolumeManager} */ | 8 /** @type {!MockVolumeManager} */ |
9 var volumeManager; | 9 var volumeManager; |
10 | 10 |
11 /** @type {!TestMediaScanner} */ | 11 /** @type {!TestMediaScanner} */ |
12 var mediaScanner; | 12 var mediaScanner; |
13 | 13 |
14 /** @type {!TestImportRunner} */ | 14 /** @type {!TestImportRunner} */ |
15 var mediaImporter; | 15 var mediaImporter; |
16 | 16 |
17 /** @type {!TestControllerEnvironment} */ | 17 /** @type {!TestControllerEnvironment} */ |
18 var environment; | 18 var environment; |
19 | 19 |
20 /** @type {!VolumeInfo} */ | 20 /** @type {!VolumeInfo} */ |
21 var sourceVolume; | 21 var sourceVolume; |
22 | 22 |
23 /** @type {!VolumeInfo} */ | 23 /** @type {!VolumeInfo} */ |
24 var destinationVolume; | 24 var destinationVolume; |
25 | 25 |
26 /** @type {!importer.TestCommandWidget} */ | 26 /** @type {!importer.TestCommandWidget} */ |
27 var widget; | 27 var widget; |
28 | 28 |
| 29 /** @type {!DirectoryEntry} */ |
| 30 var nonDcimDirectory; |
| 31 |
29 /** | 32 /** |
30 * @enum {string} | 33 * @enum {string} |
31 */ | 34 */ |
32 var MESSAGES = { | 35 var MESSAGES = { |
33 CLOUD_IMPORT_BUTTON_LABEL: 'Import it!', | 36 CLOUD_IMPORT_BUTTON_LABEL: 'Import it!', |
34 CLOUD_IMPORT_ACTIVE_IMPORT_BUTTON_LABEL: 'Already importing!', | 37 CLOUD_IMPORT_ACTIVE_IMPORT_BUTTON_LABEL: 'Already importing!', |
35 CLOUD_IMPORT_EMPTY_SCAN_BUTTON_LABEL: 'No new media', | 38 CLOUD_IMPORT_EMPTY_SCAN_BUTTON_LABEL: 'No new media', |
36 CLOUD_IMPORT_INSUFFICIENT_SPACE_BUTTON_LABEL: 'Not enough space!', | 39 CLOUD_IMPORT_INSUFFICIENT_SPACE_BUTTON_LABEL: 'Not enough space!', |
37 CLOUD_IMPORT_SCANNING_BUTTON_LABEL: 'Scanning... ...!', | 40 CLOUD_IMPORT_SCANNING_BUTTON_LABEL: 'Scanning... ...!', |
38 DRIVE_DIRECTORY_LABEL: 'My Drive', | 41 DRIVE_DIRECTORY_LABEL: 'My Drive', |
39 DOWNLOADS_DIRECTORY_LABEL: 'Downloads' | 42 DOWNLOADS_DIRECTORY_LABEL: 'Downloads' |
40 }; | 43 }; |
41 | 44 |
42 // Set up string assets. | 45 // Set up string assets. |
43 loadTimeData.data = MESSAGES; | 46 loadTimeData.data = MESSAGES; |
44 | 47 |
45 function setUp() { | 48 function setUp() { |
46 new MockChromeStorageAPI(); | 49 new MockChromeStorageAPI(); |
47 | 50 |
48 widget = new importer.TestCommandWidget(); | 51 widget = new importer.TestCommandWidget(); |
49 | 52 |
| 53 nonDcimDirectory = new MockDirectoryEntry( |
| 54 new MockFileSystem('testFs'), |
| 55 '/jellybeans/'); |
| 56 |
50 volumeManager = new MockVolumeManager(); | 57 volumeManager = new MockVolumeManager(); |
51 MockVolumeManager.installMockSingleton(volumeManager); | 58 MockVolumeManager.installMockSingleton(volumeManager); |
52 | 59 |
53 destinationVolume = volumeManager.getCurrentProfileVolumeInfo( | 60 destinationVolume = volumeManager.getCurrentProfileVolumeInfo( |
54 VolumeManagerCommon.VolumeType.DOWNLOADS); | 61 VolumeManagerCommon.VolumeType.DOWNLOADS); |
55 | 62 |
56 mediaScanner = new TestMediaScanner(); | 63 mediaScanner = new TestMediaScanner(); |
57 mediaImporter = new TestImportRunner(); | 64 mediaImporter = new TestImportRunner(); |
58 } | 65 } |
59 | 66 |
(...skipping 28 matching lines...) Expand all Loading... |
88 '/DCIM/', | 95 '/DCIM/', |
89 '/DCIM/photos0/', | 96 '/DCIM/photos0/', |
90 '/DCIM/photos0/IMG00001.jpg', | 97 '/DCIM/photos0/IMG00001.jpg', |
91 '/DCIM/photos0/IMG00002.jpg', | 98 '/DCIM/photos0/IMG00002.jpg', |
92 '/DCIM/photos1/', | 99 '/DCIM/photos1/', |
93 '/DCIM/photos1/IMG00001.jpg', | 100 '/DCIM/photos1/IMG00001.jpg', |
94 '/DCIM/photos1/IMG00003.jpg' | 101 '/DCIM/photos1/IMG00003.jpg' |
95 ], | 102 ], |
96 '/DCIM'); | 103 '/DCIM'); |
97 | 104 |
98 environment.directoryChangedListener_(EMPTY_EVENT); | 105 var dcim = environment.getCurrentDirectory(); |
| 106 |
| 107 environment.directoryChangedListener(EMPTY_EVENT); |
99 var promise = widget.updateResolver.promise.then( | 108 var promise = widget.updateResolver.promise.then( |
| 109 function() { |
| 110 // Reset the promise so we can wait on a second widget update. |
| 111 widget.resetPromises(); |
| 112 environment.setCurrentDirectory(nonDcimDirectory); |
| 113 environment.simulateUnmount(); |
| 114 |
| 115 environment.setCurrentDirectory(dcim); |
| 116 environment.directoryChangedListener(EMPTY_EVENT); |
| 117 // Return the new promise, so subsequent "thens" only |
| 118 // fire once the widget has been updated again. |
| 119 return widget.updateResolver.promise; |
| 120 }).then( |
100 function() { | 121 function() { |
101 // Reset the promise so we can wait on a second widget update. | 122 mediaScanner.assertScanCount(2); |
102 widget.resetPromises(); | 123 }); |
103 | |
104 // Faux unmount the volume, then request an update again. | |
105 // A fresh new scan should be started. | |
106 environment.simulateUnmount(); | |
107 | |
108 environment.directoryChangedListener_(EMPTY_EVENT); | |
109 // Return the new promise, so subsequent "thens" only | |
110 // fire once the widget has been updated again. | |
111 return widget.updateResolver.promise; | |
112 }).then( | |
113 function() { | |
114 mediaScanner.assertScanCount(2); | |
115 }); | |
116 | 124 |
117 reportPromise(promise, callback); | 125 reportPromise(promise, callback); |
118 } | 126 } |
119 | 127 |
120 function testDirectoryChange_TriggersUpdate(callback) { | 128 function testDirectoryChange_TriggersUpdate(callback) { |
121 var controller = createController( | 129 var controller = createController( |
122 VolumeManagerCommon.VolumeType.MTP, | 130 VolumeManagerCommon.VolumeType.MTP, |
123 'mtp-volume', | 131 'mtp-volume', |
124 [ | 132 [ |
125 '/DCIM/', | 133 '/DCIM/', |
126 '/DCIM/photos0/', | 134 '/DCIM/photos0/', |
127 '/DCIM/photos0/IMG00001.jpg', | 135 '/DCIM/photos0/IMG00001.jpg', |
128 ], | 136 ], |
129 '/DCIM'); | 137 '/DCIM'); |
130 | 138 |
131 environment.directoryChangedListener_(EMPTY_EVENT); | 139 environment.directoryChangedListener(EMPTY_EVENT); |
132 reportPromise(widget.updateResolver.promise, callback); | 140 reportPromise(widget.updateResolver.promise, callback); |
133 } | 141 } |
134 | 142 |
| 143 function testDirectoryChange_CancelsScan(callback) { |
| 144 var controller = createController( |
| 145 VolumeManagerCommon.VolumeType.MTP, |
| 146 'mtp-volume', |
| 147 [ |
| 148 '/DCIM/', |
| 149 '/DCIM/photos0/', |
| 150 '/DCIM/photos0/IMG00001.jpg', |
| 151 '/DCIM/photos0/IMG00002.jpg', |
| 152 '/DCIM/photos1/', |
| 153 '/DCIM/photos1/IMG00001.jpg', |
| 154 '/DCIM/photos1/IMG00003.jpg' |
| 155 ], |
| 156 '/DCIM'); |
| 157 |
| 158 environment.directoryChangedListener(EMPTY_EVENT); |
| 159 var promise = widget.updateResolver.promise.then( |
| 160 function() { |
| 161 // Reset the promise so we can wait on a second widget update. |
| 162 widget.resetPromises(); |
| 163 environment.setCurrentDirectory(nonDcimDirectory); |
| 164 environment.directoryChangedListener(EMPTY_EVENT); |
| 165 }).then( |
| 166 function() { |
| 167 mediaScanner.assertScanCount(1); |
| 168 mediaScanner.assertLastScanCanceled(); |
| 169 }); |
| 170 |
| 171 reportPromise(promise, callback); |
| 172 } |
| 173 |
| 174 function testWindowClose_CancelsScan(callback) { |
| 175 var controller = createController( |
| 176 VolumeManagerCommon.VolumeType.MTP, |
| 177 'mtp-volume', |
| 178 [ |
| 179 '/DCIM/', |
| 180 '/DCIM/photos0/', |
| 181 '/DCIM/photos0/IMG00001.jpg', |
| 182 '/DCIM/photos0/IMG00002.jpg', |
| 183 '/DCIM/photos1/', |
| 184 '/DCIM/photos1/IMG00001.jpg', |
| 185 '/DCIM/photos1/IMG00003.jpg' |
| 186 ], |
| 187 '/DCIM'); |
| 188 |
| 189 environment.directoryChangedListener(EMPTY_EVENT); |
| 190 var promise = widget.updateResolver.promise.then( |
| 191 function() { |
| 192 // Reset the promise so we can wait on a second widget update. |
| 193 widget.resetPromises(); |
| 194 environment.windowCloseListener(); |
| 195 }).then( |
| 196 function() { |
| 197 mediaScanner.assertScanCount(1); |
| 198 mediaScanner.assertLastScanCanceled(); |
| 199 }); |
| 200 |
| 201 reportPromise(promise, callback); |
| 202 } |
| 203 |
135 function testDirectoryChange_DetailsPanelVisibility_InitialChangeDir() { | 204 function testDirectoryChange_DetailsPanelVisibility_InitialChangeDir() { |
136 var controller = createController( | 205 var controller = createController( |
137 VolumeManagerCommon.VolumeType.MTP, | 206 VolumeManagerCommon.VolumeType.MTP, |
138 'mtp-volume', | 207 'mtp-volume', |
139 [ | 208 [ |
140 '/DCIM/', | 209 '/DCIM/', |
141 '/DCIM/photos0/', | 210 '/DCIM/photos0/', |
142 '/DCIM/photos0/IMG00001.jpg', | 211 '/DCIM/photos0/IMG00001.jpg', |
143 ], | 212 ], |
144 '/DCIM'); | 213 '/DCIM'); |
145 | 214 |
146 var event = new Event('directory-changed'); | 215 var event = new Event('directory-changed'); |
147 event.newDirEntry = new MockDirectoryEntry( | 216 event.newDirEntry = new MockDirectoryEntry( |
148 new MockFileSystem('testFs'), | 217 new MockFileSystem('testFs'), |
149 '/DCIM/'); | 218 '/DCIM/'); |
150 | 219 |
151 environment.directoryChangedListener_(event); | 220 environment.directoryChangedListener(event); |
152 assertTrue(widget.detailsVisible); | 221 assertTrue(widget.detailsVisible); |
153 } | 222 } |
154 | 223 |
155 function testDirectoryChange_DetailsPanelVisibility_SubsequentChangeDir() { | 224 function testDirectoryChange_DetailsPanelVisibility_SubsequentChangeDir() { |
156 var controller = createController( | 225 var controller = createController( |
157 VolumeManagerCommon.VolumeType.MTP, | 226 VolumeManagerCommon.VolumeType.MTP, |
158 'mtp-volume', | 227 'mtp-volume', |
159 [ | 228 [ |
160 '/DCIM/', | 229 '/DCIM/', |
161 '/DCIM/photos0/', | 230 '/DCIM/photos0/', |
162 '/DCIM/photos0/IMG00001.jpg', | 231 '/DCIM/photos0/IMG00001.jpg', |
163 ], | 232 ], |
164 '/DCIM'); | 233 '/DCIM'); |
165 | 234 |
166 var event = new Event('directory-changed'); | 235 var event = new Event('directory-changed'); |
167 event.newDirEntry = new MockDirectoryEntry( | 236 event.newDirEntry = new MockDirectoryEntry( |
168 new MockFileSystem('testFs'), | 237 new MockFileSystem('testFs'), |
169 '/DCIM/'); | 238 '/DCIM/'); |
170 // Any previous dir at all will skip the new window logic. | 239 // Any previous dir at all will skip the new window logic. |
171 event.previousDirEntry = event.newDirEntry; | 240 event.previousDirEntry = event.newDirEntry; |
172 | 241 |
173 environment.directoryChangedListener_(event); | 242 environment.directoryChangedListener(event); |
174 assertFalse(widget.detailsVisible); | 243 assertFalse(widget.detailsVisible); |
175 } | 244 } |
176 | 245 |
177 function testSelectionChange_TriggersUpdate(callback) { | 246 function testSelectionChange_TriggersUpdate(callback) { |
178 var controller = createController( | 247 var controller = createController( |
179 VolumeManagerCommon.VolumeType.MTP, | 248 VolumeManagerCommon.VolumeType.MTP, |
180 'mtp-volume', | 249 'mtp-volume', |
181 [ | 250 [ |
182 '/DCIM/', | 251 '/DCIM/', |
183 '/DCIM/photos0/', | 252 '/DCIM/photos0/', |
184 '/DCIM/photos0/IMG00001.jpg', | 253 '/DCIM/photos0/IMG00001.jpg', |
185 ], | 254 ], |
186 '/DCIM'); | 255 '/DCIM'); |
187 | 256 |
188 environment.selectionChangedListener_(); | 257 var fileSystem = new MockFileSystem('testFs'); |
| 258 // ensure there is some content in the scan so the code that depends |
| 259 // on this state doesn't croak which it finds it missing. |
| 260 environment.selection.push( |
| 261 new MockFileEntry(fileSystem, '/DCIM/photos0/IMG00001.jpg', {size: 0})); |
| 262 |
| 263 environment.selectionChangedListener(); |
| 264 mediaScanner.finalizeScans(); |
189 reportPromise(widget.updateResolver.promise, callback); | 265 reportPromise(widget.updateResolver.promise, callback); |
190 } | 266 } |
191 | 267 |
192 function testFinalizeScans_TriggersUpdate(callback) { | 268 function testFinalizeScans_TriggersUpdate(callback) { |
193 var controller = createController( | 269 var controller = createController( |
194 VolumeManagerCommon.VolumeType.MTP, | 270 VolumeManagerCommon.VolumeType.MTP, |
195 'mtp-volume', | 271 'mtp-volume', |
196 [ | 272 [ |
197 '/DCIM/', | 273 '/DCIM/', |
198 '/DCIM/photos0/', | 274 '/DCIM/photos0/', |
199 '/DCIM/photos0/IMG00001.jpg', | 275 '/DCIM/photos0/IMG00001.jpg', |
200 ], | 276 ], |
201 '/DCIM'); | 277 '/DCIM'); |
202 | 278 |
203 var fileSystem = new MockFileSystem('testFs'); | 279 var fileSystem = new MockFileSystem('testFs'); |
204 // ensure there is some content in the scan so the code that depends | 280 // ensure there is some content in the scan so the code that depends |
205 // on this state doesn't croak which it finds it missing. | 281 // on this state doesn't croak which it finds it missing. |
206 mediaScanner.fileEntries.push( | 282 mediaScanner.fileEntries.push( |
207 new MockFileEntry(fileSystem, '/DCIM/photos0/IMG00001.jpg', {size: 0})); | 283 new MockFileEntry(fileSystem, '/DCIM/photos0/IMG00001.jpg', {size: 0})); |
208 | 284 |
209 environment.directoryChangedListener_(EMPTY_EVENT); // initiates a scan. | 285 environment.directoryChangedListener(EMPTY_EVENT); // initiates a scan. |
210 widget.resetPromises(); | 286 widget.resetPromises(); |
211 mediaScanner.finalizeScans(); | 287 mediaScanner.finalizeScans(); |
212 | 288 |
213 reportPromise(widget.updateResolver.promise, callback); | 289 reportPromise(widget.updateResolver.promise, callback); |
214 } | 290 } |
215 | 291 |
216 function testClickDestination_ShowsRootPriorToImport(callback) { | 292 function testClickDestination_ShowsRootPriorToImport(callback) { |
217 var controller = createController( | 293 var controller = createController( |
218 VolumeManagerCommon.VolumeType.MTP, | 294 VolumeManagerCommon.VolumeType.MTP, |
219 'mtp-volume', | 295 'mtp-volume', |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 ], | 332 ], |
257 '/DCIM'); | 333 '/DCIM'); |
258 | 334 |
259 var fileSystem = new MockFileSystem('testFs'); | 335 var fileSystem = new MockFileSystem('testFs'); |
260 // ensure there is some content in the scan so the code that depends | 336 // ensure there is some content in the scan so the code that depends |
261 // on this state doesn't croak which it finds it missing. | 337 // on this state doesn't croak which it finds it missing. |
262 mediaScanner.fileEntries.push( | 338 mediaScanner.fileEntries.push( |
263 new MockFileEntry(fileSystem, '/DCIM/photos0/IMG00001.jpg', {size: 0})); | 339 new MockFileEntry(fileSystem, '/DCIM/photos0/IMG00001.jpg', {size: 0})); |
264 | 340 |
265 // First we need to force the controller into a scanning state. | 341 // First we need to force the controller into a scanning state. |
266 environment.directoryChangedListener_(EMPTY_EVENT); | 342 environment.directoryChangedListener(EMPTY_EVENT); |
267 | 343 |
268 return widget.updateResolver.promise.then( | 344 return widget.updateResolver.promise.then( |
269 function() { | 345 function() { |
270 widget.resetPromises(); | 346 widget.resetPromises(); |
271 mediaScanner.finalizeScans(); | 347 mediaScanner.finalizeScans(); |
272 return widget.updateResolver.promise.then( | 348 return widget.updateResolver.promise.then( |
273 function() { | 349 function() { |
274 widget.resetPromises(); | 350 widget.resetPromises(); |
275 widget.click(clickSource); | 351 widget.click(clickSource); |
276 return mediaImporter.importResolver.promise; | 352 return mediaImporter.importResolver.promise; |
277 }); | 353 }); |
278 }); | 354 }); |
279 } | 355 } |
280 | 356 |
281 /** | 357 /** |
282 * A stub that just provides interfaces from ImportTask that are required by | 358 * A stub that just provides interfaces from ImportTask that are required by |
283 * these tests. | 359 * these tests. |
284 * | 360 * |
285 * @constructor | 361 * @constructor |
286 * | 362 * |
287 * @param {!impoter.ScanResult} scan | 363 * @param {!impoter.ScanResult} scan |
288 * @param {!impoter.Destination} destination | 364 * @param {!impoter.Destination} destination |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 * @param {!VolumeInfo} volumeInfo | 463 * @param {!VolumeInfo} volumeInfo |
388 * @param {!DirectoryEntry} directory | 464 * @param {!DirectoryEntry} directory |
389 */ | 465 */ |
390 TestControllerEnvironment = function(volumeInfo, directory) { | 466 TestControllerEnvironment = function(volumeInfo, directory) { |
391 /** @private {!VolumeInfo} */ | 467 /** @private {!VolumeInfo} */ |
392 this.volumeInfo_ = volumeInfo; | 468 this.volumeInfo_ = volumeInfo; |
393 | 469 |
394 /** @private {!DirectoryEntry} */ | 470 /** @private {!DirectoryEntry} */ |
395 this.directory_ = directory; | 471 this.directory_ = directory; |
396 | 472 |
397 /** @private {function(string)} */ | 473 /** @public {function()} */ |
398 this.volumeUnmountListener_; | 474 this.windowCloseListener; |
399 | 475 |
400 /** @private {function()} */ | 476 /** @public {function(string)} */ |
401 this.directoryChangedListener_; | 477 this.volumeUnmountListener; |
402 | 478 |
403 /** @private {function()} */ | 479 /** @public {function()} */ |
404 this.selectionChangedListener_; | 480 this.directoryChangedListener; |
| 481 |
| 482 /** @public {function()} */ |
| 483 this.selectionChangedListener; |
405 | 484 |
406 /** @public {!Entry} */ | 485 /** @public {!Entry} */ |
407 this.selection = []; | 486 this.selection = []; |
408 | 487 |
409 /** @public {boolean} */ | 488 /** @public {boolean} */ |
410 this.isDriveMounted = true; | 489 this.isDriveMounted = true; |
411 | 490 |
412 /** @public {number} */ | 491 /** @public {number} */ |
413 this.freeStorageSpace = 123456789; // bytes | 492 this.freeStorageSpace = 123456789; // bytes |
414 | 493 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 return this.isDriveMounted; | 527 return this.isDriveMounted; |
449 }; | 528 }; |
450 | 529 |
451 /** @override */ | 530 /** @override */ |
452 TestControllerEnvironment.prototype.getFreeStorageSpace = | 531 TestControllerEnvironment.prototype.getFreeStorageSpace = |
453 function() { | 532 function() { |
454 return Promise.resolve(this.freeStorageSpace); | 533 return Promise.resolve(this.freeStorageSpace); |
455 }; | 534 }; |
456 | 535 |
457 /** @override */ | 536 /** @override */ |
| 537 TestControllerEnvironment.prototype.addWindowCloseListener = |
| 538 function(listener) { |
| 539 this.windowCloseListener = listener; |
| 540 }; |
| 541 |
| 542 /** @override */ |
458 TestControllerEnvironment.prototype.addVolumeUnmountListener = | 543 TestControllerEnvironment.prototype.addVolumeUnmountListener = |
459 function(listener) { | 544 function(listener) { |
460 this.volumeUnmountListener_ = listener; | 545 this.volumeUnmountListener = listener; |
461 }; | 546 }; |
462 | 547 |
463 /** @override */ | 548 /** @override */ |
464 TestControllerEnvironment.prototype.addDirectoryChangedListener = | 549 TestControllerEnvironment.prototype.addDirectoryChangedListener = |
465 function(listener) { | 550 function(listener) { |
466 this.directoryChangedListener_ = listener; | 551 this.directoryChangedListener = listener; |
467 }; | 552 }; |
468 | 553 |
469 /** @override */ | 554 /** @override */ |
470 TestControllerEnvironment.prototype.addSelectionChangedListener = | 555 TestControllerEnvironment.prototype.addSelectionChangedListener = |
471 function(listener) { | 556 function(listener) { |
472 this.selectionChangedListener_ = listener; | 557 this.selectionChangedListener = listener; |
473 }; | 558 }; |
474 | 559 |
475 /** @override */ | 560 /** @override */ |
476 TestControllerEnvironment.prototype.getImportDestination = | 561 TestControllerEnvironment.prototype.getImportDestination = |
477 function(date) { | 562 function(date) { |
478 var fileSystem = new MockFileSystem('testFs'); | 563 var fileSystem = new MockFileSystem('testFs'); |
479 return new MockDirectoryEntry(fileSystem, '/abc/123'); | 564 return new MockDirectoryEntry(fileSystem, '/abc/123'); |
480 }; | 565 }; |
481 | 566 |
482 /** @override */ | 567 /** @override */ |
483 TestControllerEnvironment.prototype.showImportDestination = function() { | 568 TestControllerEnvironment.prototype.showImportDestination = function() { |
484 this.showImportDestinationResolver.resolve(); | 569 this.showImportDestinationResolver.resolve(); |
485 }; | 570 }; |
486 | 571 |
487 /** @override */ | 572 /** @override */ |
488 TestControllerEnvironment.prototype.showImportRoot = function() { | 573 TestControllerEnvironment.prototype.showImportRoot = function() { |
489 this.showImportRootResolver.resolve(); | 574 this.showImportRootResolver.resolve(); |
490 }; | 575 }; |
491 | 576 |
492 /** | 577 /** |
493 * Simulates an unmount event. | 578 * Simulates an unmount event. |
494 */ | 579 */ |
495 TestControllerEnvironment.prototype.simulateUnmount = function() { | 580 TestControllerEnvironment.prototype.simulateUnmount = function() { |
496 this.volumeUnmountListener_(this.volumeInfo_.volumeId); | 581 this.volumeUnmountListener(this.volumeInfo_.volumeId); |
497 }; | 582 }; |
498 | 583 |
499 /** | 584 /** |
500 * Test implementation of importer.CommandWidget. | 585 * Test implementation of importer.CommandWidget. |
501 * | 586 * |
502 * @constructor | 587 * @constructor |
503 * @implements {importer.CommandWidget} | 588 * @implements {importer.CommandWidget} |
504 * @struct | 589 * @struct |
505 */ | 590 */ |
506 importer.TestCommandWidget = function() { | 591 importer.TestCommandWidget = function() { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 * @param {!Array.<string>} fileNames | 686 * @param {!Array.<string>} fileNames |
602 * @return {!VolumeInfo} | 687 * @return {!VolumeInfo} |
603 */ | 688 */ |
604 function setupFileSystem(volumeType, volumeId, fileNames) { | 689 function setupFileSystem(volumeType, volumeId, fileNames) { |
605 var volumeInfo = volumeManager.createVolumeInfo( | 690 var volumeInfo = volumeManager.createVolumeInfo( |
606 volumeType, volumeId, 'A volume known as ' + volumeId); | 691 volumeType, volumeId, 'A volume known as ' + volumeId); |
607 assertTrue(volumeInfo != null); | 692 assertTrue(volumeInfo != null); |
608 volumeInfo.fileSystem.populate(fileNames); | 693 volumeInfo.fileSystem.populate(fileNames); |
609 return volumeInfo; | 694 return volumeInfo; |
610 } | 695 } |
OLD | NEW |