Chromium Code Reviews| 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 5110334478a569e522d7be6c536783c47f3d8b84..197a0adc7693248df74d564fb069413c2928939a 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 |
| @@ -2,6 +2,20 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
|
yoshiki
2014/08/07 09:35:30
jsdoc
hirono
2014/08/08 03:37:41
Done.
|
| +function MockEntry(volumeId, fullPath) { |
| + this.volumeId = volumeId; |
| + this.fullPath = fullPath; |
| +} |
| + |
| +/** |
| + * Returns fake URL. |
| + * |
| + * @return {string} Fake URL. |
| + */ |
| +MockEntry.prototype.toURL = function() { |
| + return 'filesystem:' + this.volumeId + this.fullPath; |
| +}; |
| + |
| /** |
| * Mock class for FileEntry. |
| * |
| @@ -9,18 +23,26 @@ |
| * @param {string} fullPath Full path for the entry. |
| * @constructor |
| */ |
| -function MockFileEntry(volumeId, fullPath) { |
| +function MockFileEntry(volumeId, fullPath, metadata) { |
| + MockEntry.call(this, volumeId, fullPath); |
| this.volumeId = volumeId; |
| this.fullPath = fullPath; |
| + this.metadata_ = metadata; |
| } |
| +MockFileEntry.prototype = { |
| + __proto__: MockEntry.prototype |
| +}; |
| + |
| /** |
| - * Returns fake URL. |
| - * |
| - * @return {string} Fake URL. |
| + * Obtains metadata of the entry. |
| + * @param {function(Object)} callback Function to take the metadata. |
| */ |
| -MockFileEntry.prototype.toURL = function() { |
| - return 'filesystem:' + this.volumeId + this.fullPath; |
| +MockFileEntry.prototype.getMetadata = function(callback) { |
| + Promise.resolve(this.metadata_).then(callback).catch(function(error) { |
| + console.log(error); |
|
yoshiki
2014/08/07 09:35:30
Please use 'console.error' if it's an error.
hirono
2014/08/08 03:37:41
Done.
|
| + window.onerror(); |
| + }); |
| }; |
| /** |
| @@ -33,9 +55,14 @@ MockFileEntry.prototype.toURL = function() { |
| * @constructor |
| */ |
| function MockDirectoryEntry(volumeId, fullPath, contents) { |
| + MockEntry.call(this, volumeId, fullPath); |
| this.contents_ = contents; |
| } |
| +MockDirectoryEntry.prototype = { |
| + __proto__: MockEntry.prototype |
| +}; |
| + |
| /** |
| * Returns a file under the directory. |
| * |