Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: ui/file_manager/file_manager/background/js/media_import_handler_unittest.js

Issue 1032513002: Files.app: Tag cloud imported media files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/file_manager/file_manager/background/js/media_import_handler.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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([
« no previous file with comments | « ui/file_manager/file_manager/background/js/media_import_handler.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698