| Index: ui/file_manager/file_manager/foreground/js/list_thumbnail_loader_unittest.js
|
| diff --git a/ui/file_manager/file_manager/foreground/js/list_thumbnail_loader_unittest.js b/ui/file_manager/file_manager/foreground/js/list_thumbnail_loader_unittest.js
|
| index 6e2ea08259f15a097432627a8d2ef9e1d3cfc108..80ff510888b27dbaa88072512151d45b367db14e 100644
|
| --- a/ui/file_manager/file_manager/foreground/js/list_thumbnail_loader_unittest.js
|
| +++ b/ui/file_manager/file_manager/foreground/js/list_thumbnail_loader_unittest.js
|
| @@ -45,7 +45,9 @@ var listThumbnailLoader;
|
| var getCallbacks;
|
| var thumbnailLoadedEvents;
|
| var fileListModel;
|
| +var directoryModel;
|
| var currentVolumeType;
|
| +var isScanningForTest = false;
|
| var fileSystem = new MockFileSystem('volume-id');
|
| var directory1 = new MockDirectoryEntry(fileSystem, '/TestDirectory');
|
| var entry1 = new MockEntry(fileSystem, '/Test1.jpg');
|
| @@ -75,8 +77,18 @@ function setUp() {
|
|
|
| fileListModel = new FileListModel(thumbnailModel);
|
|
|
| + directoryModel = {
|
| + __proto__: cr.EventTarget.prototype,
|
| + getFileList: function() {
|
| + return fileListModel;
|
| + },
|
| + isScanning: function() {
|
| + return isScanningForTest;
|
| + }
|
| + };
|
| +
|
| listThumbnailLoader = new ListThumbnailLoader(
|
| - fileListModel,
|
| + directoryModel,
|
| thumbnailModel,
|
| // Mocking volume manager
|
| {
|
| @@ -337,3 +349,22 @@ function testMTPVolume() {
|
| // Only one request should be enqueued on MTP volume.
|
| assertEquals(1, Object.keys(getCallbacks).length);
|
| }
|
| +
|
| +/**
|
| + * Test case that directory scan is running.
|
| + */
|
| +function testDirectoryScanIsRunning() {
|
| + // Items are added during directory scan.
|
| + isScanningForTest = true;
|
| +
|
| + listThumbnailLoader.setHighPriorityRange(0,2);
|
| + fileListModel.push(directory1, entry1, entry2);
|
| + assertEquals(0, Object.keys(getCallbacks).length);
|
| +
|
| + // Scan completed after adding the last item.
|
| + fileListModel.push(entry3);
|
| + isScanningForTest = false;
|
| + directoryModel.dispatchEvent(new Event('scan-completed'));
|
| +
|
| + assertEquals(2, Object.keys(getCallbacks).length);
|
| +}
|
|
|