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

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

Issue 805533003: Hook up import history to media scanner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert manifest.json. Created 6 years 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
new file mode 100644
index 0000000000000000000000000000000000000000..f23962e71e9cc23ca7da2862881a56c4d871030b
--- /dev/null
+++ b/ui/file_manager/file_manager/background/js/test_import_history.js
@@ -0,0 +1,56 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Namespace
+var importer = importer || {};
+
+/**
+ * importer.ImportHistory and importer.HistoryLoader test double.
+ * ONE STOP SHOPPING!
+ *
+ * @constructor
+ * @struct
+ * @implements {importer.HistoryLoader}
+ * @implements {importer.ImportHistory}
+ */
+importer.TestImportHistory = function() {
+ /**
+ * List of paths that should be considered imported.
+ * @type {!Array.<string>}
+ */
+ this.importedPaths = {};
+};
+
+/** @override */
+importer.TestImportHistory.prototype.getHistory =
+ function() {
+ return Promise.resolve(this);
+};
+
+/** @override */
+importer.TestImportHistory.prototype.wasImported =
+ function(entry, destination) {
+ var path = entry.fullPath;
+ return Promise.resolve(
+ path in this.importedPaths &&
+ this.importedPaths[path].indexOf(destination) > -1);
+};
+
+/** @override */
+importer.TestImportHistory.prototype.markImported =
+ function(entry, destination) {
+ var path = entry.fullPath;
+ if (path in this.importedPaths) {
+ this.importedPaths[path].push(destination);
+ } else {
+ this.importedPaths[path] = [destination];
+ }
+ return Promise.resolve();
+};
+
+/** @override */
+importer.TestImportHistory.prototype.addObserver = function() {};
+
+/** @override */
+importer.TestImportHistory.prototype.removeObserver = function() {};

Powered by Google App Engine
This is Rietveld 408576698