| Index: ui/file_manager/file_manager/background/js/media_scanner_unittest.js
|
| diff --git a/ui/file_manager/file_manager/background/js/media_scanner_unittest.js b/ui/file_manager/file_manager/background/js/media_scanner_unittest.js
|
| index 38527060b12f59c44eb1a861043ceeef975afda9..18dbc64f82b36e7e41c41275798fef9ea7ec768b 100644
|
| --- a/ui/file_manager/file_manager/background/js/media_scanner_unittest.js
|
| +++ b/ui/file_manager/file_manager/background/js/media_scanner_unittest.js
|
| @@ -142,6 +142,48 @@ function testScanFiles(callback) {
|
| }
|
|
|
| /**
|
| + * Verifies that scanFiles skips duplicated files.
|
| + */
|
| +function testScanFilesIgnoresPreviousImports(callback) {
|
| + var filenames = [
|
| + 'oldimage1234.jpg', // a history duplicate
|
| + 'driveimage1234.jpg', // a content duplicate
|
| + 'foo.jpg',
|
| + 'bar.gif',
|
| + 'baz.avi'
|
| + ];
|
| +
|
| + // Replace the default dispositionChecker with a function
|
| + // that treats our dupes accordingly.
|
| + dispositionChecker = function(entry, destination) {
|
| + if (entry.name === filenames[0]) {
|
| + return Promise.resolve(importer.Disposition.HISTORY_DUPLICATE);
|
| + }
|
| + if (entry.name === filenames[1]) {
|
| + return Promise.resolve(importer.Disposition.CONTENT_DUPLICATE);
|
| + }
|
| + return Promise.resolve(importer.Disposition.ORIGINAL);
|
| + };
|
| +
|
| + var expectedFiles = [
|
| + '/testScanFilesIgnoresPreviousImports/foo.jpg',
|
| + '/testScanFilesIgnoresPreviousImports/bar.gif',
|
| + '/testScanFilesIgnoresPreviousImports/baz.avi'
|
| + ];
|
| + reportPromise(
|
| + makeTestFileSystemRoot('testScanFilesIgnoresPreviousImports')
|
| + .then(populateDir.bind(null, filenames))
|
| + .then(fileOperationUtil.gatherEntriesRecursively)
|
| + .then(
|
| + /** @param {!Array<!FileEntry>} files */
|
| + function(files) {
|
| + return scanner.scanFiles(files).whenFinal();
|
| + })
|
| + .then(assertFilesFound.bind(null, expectedFiles)),
|
| + callback);
|
| +}
|
| +
|
| +/**
|
| * Verifies that scanning a simple single-level directory structure works.
|
| */
|
| function testEmptyScanResults(callback) {
|
|
|