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)); |