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

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

Issue 837563002: Show a little circly/arrowey badge for files that have been copied locally. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add copy support to test import_history and update media import handler test to check for copy resu… Created 5 years, 11 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
Index: ui/file_manager/file_manager/background/js/test_import_history.js
diff --git a/ui/file_manager/file_manager/background/js/test_import_history.js b/ui/file_manager/file_manager/background/js/test_import_history.js
index cb78260fd83a6cbcf9121d4091436f53bab7f926..880517eefe791b7e98fc4e0eaea4f4cf863ca7a9 100644
--- a/ui/file_manager/file_manager/background/js/test_import_history.js
+++ b/ui/file_manager/file_manager/background/js/test_import_history.js
@@ -15,8 +15,12 @@ var importer = importer || {};
* @implements {importer.ImportHistory}
*/
importer.TestImportHistory = function() {
+ /** @type {!Object.<string, !Object.<!importer.Destination, string>>} */
+ this.copiedPaths = {};
+
/** @type {!Object.<string, Array.<string>>} */
this.importedPaths = {};
+
};
/** @override */
@@ -29,6 +33,47 @@ importer.TestImportHistory.prototype.getHistory =
* @param {!FileEntry} entry
* @param {!importer.Destination} destination
*/
+importer.TestImportHistory.prototype.assertCopied =
+ function(entry, destination) {
+ assertTrue(this.wasCopied_(entry, destination));
+};
+
+/**
+ * Fully synchronous version of wasCopied.
+ * @param {!FileEntry} entry
+ * @param {!importer.Destination} destination
+ * @return {boolean}
+ */
+importer.TestImportHistory.prototype.wasCopied_ =
+ function(entry, destination) {
+ var path = entry.fullPath;
+ return path in this.copiedPaths &&
+ this.copiedPaths[path].indexOf(destination) > -1;
+};
+
+/** @override */
+importer.TestImportHistory.prototype.wasCopied =
+ function(entry, destination) {
+ var path = entry.fullPath;
+ return Promise.resolve(this.wasCopied_(entry, destination));
+};
+
+/** @override */
+importer.TestImportHistory.prototype.markCopied =
+ function(entry, destination) {
+ var path = entry.fullPath;
+ if (path in this.copiedPaths) {
+ this.copiedPaths[path].push(destination);
+ } else {
+ this.copiedPaths[path] = [destination];
+ }
+ return Promise.resolve();
+};
+
+/**
+ * @param {!FileEntry} entry
+ * @param {!importer.Destination} destination
+ */
importer.TestImportHistory.prototype.assertImported =
function(entry, destination) {
assertTrue(this.wasImported_(entry, destination));

Powered by Google App Engine
This is Rietveld 408576698