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

Side by Side Diff: ui/file_manager/gallery/js/gallery_data_model_unittest.js

Issue 1408533002: Turn on verbose flag for compiling file_manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use type cast for createElement, fix indent. Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var model; 5 var model;
6 var fileSystem; 6 var fileSystem;
7 var item; 7 var item;
8 8
9 /** 9 /**
10 * Mock thumbnail model. 10 * Mock thumbnail model.
(...skipping 13 matching lines...) Expand all
24 get: function() { 24 get: function() {
25 return Promise.resolve([{}]); 25 return Promise.resolve([{}]);
26 } 26 }
27 }, 27 },
28 /* Mock EntryListWatcher */{}); 28 /* Mock EntryListWatcher */{});
29 fileSystem = new MockFileSystem('volumeId'); 29 fileSystem = new MockFileSystem('volumeId');
30 model.fallbackSaveDirectory = fileSystem.root; 30 model.fallbackSaveDirectory = fileSystem.root;
31 } 31 }
32 32
33 function testSaveItemOverwrite(callback) { 33 function testSaveItemOverwrite(callback) {
34 var item = new Gallery.Item( 34 var item = new GalleryItem(
35 new MockEntry(fileSystem, '/test.jpg'), 35 new MockEntry(fileSystem, '/test.jpg'),
36 null, 36 null,
37 /* metadataItem */ {}, 37 /* metadataItem */ {},
38 /* thumbnailMetadataItem */ {}, 38 /* thumbnailMetadataItem */ {},
39 /* original */ true); 39 /* original */ true);
40 40
41 // Mocking the saveToFile method. 41 // Mocking the saveToFile method.
42 item.saveToFile = function( 42 item.saveToFile = function(
43 volumeManager, 43 volumeManager,
44 metadataModel, 44 metadataModel,
45 fallbackDir, 45 fallbackDir,
46 canvas, 46 canvas,
47 overwrite, 47 overwrite,
48 callback) { 48 callback) {
49 callback(true); 49 callback(true);
50 }; 50 };
51 model.push(item); 51 model.push(item);
52 reportPromise( 52 reportPromise(
53 model.saveItem({}, item, document.createElement('canvas'), 53 model.saveItem({}, item, document.createElement('canvas'),
54 true /* overwrite */). 54 true /* overwrite */).
55 then(function() { assertEquals(1, model.length); }), 55 then(function() { assertEquals(1, model.length); }),
56 callback); 56 callback);
57 } 57 }
58 58
59 function testSaveItemToNewFile(callback) { 59 function testSaveItemToNewFile(callback) {
60 var item = new Gallery.Item( 60 var item = new GalleryItem(
61 new MockEntry(fileSystem, '/test.webp'), 61 new MockEntry(fileSystem, '/test.webp'),
62 null, 62 null,
63 /* metadataItem */ {}, 63 /* metadataItem */ {},
64 /* thumbnailMetadataItem */ {}, 64 /* thumbnailMetadataItem */ {},
65 /* original */ true); 65 /* original */ true);
66 66
67 // Mocking the saveToFile method. In this case, Gallery saves to a new file 67 // Mocking the saveToFile method. In this case, Gallery saves to a new file
68 // since it cannot overwrite to webp image file. 68 // since it cannot overwrite to webp image file.
69 item.saveToFile = function( 69 item.saveToFile = function(
70 volumeManager, 70 volumeManager,
(...skipping 13 matching lines...) Expand all
84 false /* not overwrite */). 84 false /* not overwrite */).
85 then(function() { 85 then(function() {
86 assertEquals(2, model.length); 86 assertEquals(2, model.length);
87 assertEquals('test (1).png', model.item(0).getFileName()); 87 assertEquals('test (1).png', model.item(0).getFileName());
88 assertFalse(model.item(0).isOriginal()); 88 assertFalse(model.item(0).isOriginal());
89 assertEquals('test.webp', model.item(1).getFileName()); 89 assertEquals('test.webp', model.item(1).getFileName());
90 assertTrue(model.item(1).isOriginal()); 90 assertTrue(model.item(1).isOriginal());
91 }), 91 }),
92 callback); 92 callback);
93 } 93 }
OLDNEW
« no previous file with comments | « ui/file_manager/gallery/js/gallery_data_model_unittest.html ('k') | ui/file_manager/gallery/js/gallery_item.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698