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

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

Issue 890423004: Files.app: Add FileSystemMetadataModel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « ui/file_manager/file_manager/foreground/js/metadata/file_system_metadata_model_unittest.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/foreground/js/metadata/file_system_metadata_model_unittest.js
diff --git a/ui/file_manager/file_manager/foreground/js/metadata/file_system_metadata_model_unittest.js b/ui/file_manager/file_manager/foreground/js/metadata/file_system_metadata_model_unittest.js
new file mode 100644
index 0000000000000000000000000000000000000000..8f53d459028f44c9f3fec5d46f50325a9c2dc4d0
--- /dev/null
+++ b/ui/file_manager/file_manager/foreground/js/metadata/file_system_metadata_model_unittest.js
@@ -0,0 +1,63 @@
+// Copyright 2015 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.
+
+var entryA = {
+ toURL: function() { return 'filesystem://A'; }
+};
+
+var entryB = {
+ toURL: function() { return 'filesystem://B'; }
+};
+
+function testFileSystemMetadataModelBasic(callback) {
+ var cache = new MetadataProviderCache();
+ var model = new FileSystemMetadataModel(
+ cache,
+ // Mocking FileSystemMetadataProvider.
+ {
+ get: function(urls) {
+ assertEquals(1, urls.length);
+ assertEquals('filesystem://A', urls[0].toURL());
+ return Promise.resolve(
+ [{modificationTime: new Date(2015, 0, 1), size: 1024}]);
+ }
+ },
+ // Mocking ExternalMetadataProvider.
+ {
+ get: function(urls) {
+ assertEquals(1, urls.length);
+ assertEquals('filesystem://B', urls[0].toURL());
+ return Promise.resolve(
+ [{modificationTime: new Date(2015, 1, 2), size: 2048}]);
+ }
+ },
+ // Mocking VolumeManagerWrapper.
+ {
+ getVolumeInfo: function(entry) {
+ if (entry.toURL() === 'filesystem://A') {
+ return {
+ volumeType: VolumeManagerCommon.VolumeType.DOWNLOADS
+ };
+ } else if (entry.toURL() === 'filesystem://B') {
+ return {
+ volumeType: VolumeManagerCommon.VolumeType.DRIVE
+ };
+ }
+ assertNotReached();
+ }
+ });
+ reportPromise(
+ model.get([entryA, entryB], ['size', 'modificationTime']).then(
+ function(results) {
+ assertEquals(2, results.length);
+ assertEquals(
+ new Date(2015, 0, 1).toString(),
+ results[0].modificationTime.toString());
+ assertEquals(1024, results[0].size);
+ assertEquals(
+ new Date(2015, 1, 2).toString(),
+ results[1].modificationTime.toString());
+ assertEquals(2048, results[1].size);
+ }), callback);
+}
« no previous file with comments | « ui/file_manager/file_manager/foreground/js/metadata/file_system_metadata_model_unittest.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698