Index: ui/file_manager/file_manager/background/js/media_import_handler_unittest.js |
diff --git a/ui/file_manager/file_manager/background/js/media_import_handler_unittest.js b/ui/file_manager/file_manager/background/js/media_import_handler_unittest.js |
index 767a69ccd3f0d874335b3af3485afa28ef010f9e..554c526ed4471ff65ae4327e4285f3f4dd0a0ab5 100644 |
--- a/ui/file_manager/file_manager/background/js/media_import_handler_unittest.js |
+++ b/ui/file_manager/file_manager/background/js/media_import_handler_unittest.js |
@@ -51,6 +51,9 @@ function setUp() { |
releaseKeepAwake: function() { |
chrome.power.requestKeepAwakeStatus = false; |
} |
+ }, |
+ fileManagerPrivate: { |
+ setEntryTag: function() {} |
} |
}; |
@@ -314,6 +317,52 @@ function testUpdatesHistoryAfterImport(callback) { |
scanResult.finalize(); |
} |
+function testTagsEntriesAfterImport(callback) { |
+ var entries = setupFileSystem([ |
+ '/DCIM/photos0/IMG00001.jpg', |
+ '/DCIM/photos1/IMG00003.jpg' |
+ ]); |
+ |
+ var scanResult = new TestScanResult(entries); |
+ var importTask = mediaImporter.importFromScanResult( |
+ scanResult, |
+ importer.Destination.GOOGLE_DRIVE, |
+ destinationFactory); |
+ var whenImportDone = new Promise( |
+ function(resolve, reject) { |
+ importTask.addObserver( |
+ /** |
+ * @param {!importer.TaskQueue.UpdateType} updateType |
+ * @param {!importer.TaskQueue.Task} task |
+ */ |
+ function(updateType, task) { |
+ switch (updateType) { |
+ case importer.TaskQueue.UpdateType.COMPLETE: |
+ resolve(); |
+ break; |
+ case importer.TaskQueue.UpdateType.ERROR: |
+ reject(new Error(importer.TaskQueue.UpdateType.ERROR)); |
+ break; |
+ } |
+ }); |
+ }); |
+ |
+ var taggedUrls = []; |
+ // Replace chrome.fileManagerPrivate.setEntryTag with a listener. |
+ chrome.fileManagerPrivate.setEntryTag = function(url) { |
+ taggedUrls.push(url); |
+ }; |
+ |
+ reportPromise( |
+ whenImportDone.then( |
+ function() { |
+ assertEquals(entries.length, taggedUrls.length); |
+ }), |
+ callback); |
+ |
+ scanResult.finalize(); |
+} |
+ |
// Tests that cancelling an import works properly. |
function testImportCancellation(callback) { |
var media = setupFileSystem([ |