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

Unified Diff: ui/file_manager/file_manager/foreground/js/thumbnail_loader_unittest.js

Issue 831833004: Files.app: Stop to use drive thumbnail for cached files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix. Created 5 years, 11 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: ui/file_manager/file_manager/foreground/js/thumbnail_loader_unittest.js
diff --git a/ui/file_manager/file_manager/foreground/js/thumbnail_loader_unittest.js b/ui/file_manager/file_manager/foreground/js/thumbnail_loader_unittest.js
new file mode 100644
index 0000000000000000000000000000000000000000..b306b668b37432f12e317daa29818b1a41d13a85
--- /dev/null
+++ b/ui/file_manager/file_manager/foreground/js/thumbnail_loader_unittest.js
@@ -0,0 +1,35 @@
+// 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.
+
+function getLoadTarget(entry, metadata) {
+ return new ThumbnailLoader(entry, null, metadata).getLoadTarget();
+}
+
+function testShouldUseMetadataThumbnail() {
+ var mockFileSystem = new MockFileSystem('volumeId');
+ var imageEntry = new MockEntry(mockFileSystem, '/test.jpg');
+ var pdfEntry = new MockEntry(mockFileSystem, '/test.pdf');
+
+ // Embed thumbnail is provided.
+ assertEquals(
+ ThumbnailLoader.LoadTarget.CONTENT_METADATA,
+ getLoadTarget(imageEntry, {thumbnail: {url: 'url'}}));
+
+ // Drive thumbnail is provided and the file is not cached locally.
+ assertEquals(
+ ThumbnailLoader.LoadTarget.EXTERNAL_METADATA,
+ getLoadTarget(imageEntry, {external: {thumbnailUrl: 'url'}}));
+
+ // Drive thumbnail is provided but the file is not synced.
+ assertEquals(
+ ThumbnailLoader.LoadTarget.FILE_ENTRY,
+ getLoadTarget(
+ imageEntry, {external: {thumbnailUrl: 'url', dirty: true}}));
+
+ // Drive thumbnail is provided and it is not an image file.
+ assertEquals(
+ ThumbnailLoader.LoadTarget.EXTERNAL_METADATA,
+ getLoadTarget(
+ pdfEntry, {external: {thumbnailUrl: 'url', dirty: true}}));
+}

Powered by Google App Engine
This is Rietveld 408576698