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

Unified Diff: ui/file_manager/file_manager/foreground/js/metadata/mock_metadata_cache.js

Issue 821003002: Files.app: Fix TaskController so that it calls correct default task. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add Licence 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/foreground/js/metadata/mock_metadata_cache.js
diff --git a/ui/file_manager/file_manager/foreground/js/metadata/mock_metadata_cache.js b/ui/file_manager/file_manager/foreground/js/metadata/mock_metadata_cache.js
index 8ae2b28e3282480b8596c09aaa8adc8556afaf20..01f0312738ab95add32310a197679aded382dc18 100644
--- a/ui/file_manager/file_manager/foreground/js/metadata/mock_metadata_cache.js
+++ b/ui/file_manager/file_manager/foreground/js/metadata/mock_metadata_cache.js
@@ -25,6 +25,17 @@ MockMetadataCache.prototype.getLatest = function(entries, type, callback) {
};
/**
+ * @param {!Array<!Entry>} entries
+ * @param {string} type
+ * @param {function(!Array<!Object>)} callback
+ */
+MockMetadataCache.prototype.get = function(entries, type, callback) {
+ return Promise.resolve(entries.map(function(entry) {
+ return this.getOne_(entry, type);
+ }.bind(this))).then(callback);
+};
+
+/**
* Fetches metadata for one entry.
* @param {Entry} entry The entry.
* @param {string} type The metadata type.
@@ -33,8 +44,8 @@ MockMetadataCache.prototype.getLatest = function(entries, type, callback) {
* @private
*/
MockMetadataCache.prototype.getOne_ = function(entry, type) {
- if (this.metadata_[entry] && this.metadata_[entry][type])
- return this.metadata_[entry][type];
+ if (this.metadata_[entry.toURL()] && this.metadata_[entry.toURL()][type])
+ return this.metadata_[entry.toURL()][type];
else
return null;
};
@@ -46,5 +57,7 @@ MockMetadataCache.prototype.getOne_ = function(entry, type) {
* @param {Object} value The metadata for the entry and the type.
*/
MockMetadataCache.prototype.setForTest = function(entry, type, value) {
- this.metadata_[entry][type] = value;
+ if (!this.metadata_[entry.toURL()])
+ this.metadata_[entry.toURL()] = {};
+ this.metadata_[entry.toURL()][type] = value;
};

Powered by Google App Engine
This is Rietveld 408576698