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

Unified Diff: chrome/test/data/file_manager/unit_tests/mocks/mock_entry.js

Issue 663513003: Add an unittest for background/volume_manager.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comments. Created 6 years, 2 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: chrome/test/data/file_manager/unit_tests/mocks/mock_entry.js
diff --git a/chrome/test/data/file_manager/unit_tests/mocks/mock_entry.js b/chrome/test/data/file_manager/unit_tests/mocks/mock_entry.js
index 9c0b5924ec5845346d19439d5de0b9a0ec268831..36759dad73271383c89c267204a8ee71b1845797 100644
--- a/chrome/test/data/file_manager/unit_tests/mocks/mock_entry.js
+++ b/chrome/test/data/file_manager/unit_tests/mocks/mock_entry.js
@@ -45,6 +45,9 @@ MockEntry.prototype = {
*/
get name() {
return this.fullPath.replace(/^.*\//, '');
+ },
+ get fileSystem() {
hirono 2014/10/24 07:12:21 Is it needed? We already have filesystem property.
yawano 2014/10/27 00:25:08 Sorry, this method was unnecessary. I deleted.
+ return this.filesystem;
}
};
@@ -54,7 +57,11 @@ MockEntry.prototype = {
* @return {string} Fake URL.
*/
MockEntry.prototype.toURL = function() {
- return 'filesystem:' + this.filesystem.fileSystemId + this.fullPath;
+ if(this.filesystem.fileSystemId) {
+ return 'filesystem:' + this.filesystem.fileSystemId + this.fullPath;
+ } else {
+ return 'filesystem:' + this.filesystem.name + this.fullPath;
+ }
};
/**
@@ -212,3 +219,23 @@ MockDirectoryEntry.prototype.getDirectory =
else
onSuccess(this.filesystem.entries[fullPath]);
};
+
+/**
+ * Creates a MockDirectoryReader for the entry.
+ */
+MockDirectoryEntry.prototype.createReader = function() {
+ return new MockDirectoryReader();
+}
+
+/**
+ * Mock class for DirectoryReader.
+ */
+function MockDirectoryReader() {}
+
+/**
+ * Reads entries.
+ * Current implementation just calls success callback.
+ */
+MockDirectoryReader.prototype.readEntries = function(success, error) {
+ success();
+}

Powered by Google App Engine
This is Rietveld 408576698