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

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

Issue 853653004: Gallery: Add items to GalleryDataModel before loading their metadata. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed. Created 5 years, 8 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 5
6 var model; 6 var model;
7 var fileSystem; 7 var fileSystem;
8 var item; 8 var item;
9 9
10 /**
11 * Mock thumbnail model.
12 */
13 function ThumbnailModel() {
14 }
15
16 ThumbnailModel.prototype.get = function(entries) {
17 return Promise.resolve(entries.map(function() {
18 return {};
19 }));
20 };
21
10 function setUp() { 22 function setUp() {
11 model = new GalleryDataModel( 23 model = new GalleryDataModel(
12 /* Mock MetadataModel */{}, 24 /* Mock MetadataModel */{
25 get: function() {
26 return Promise.resolve([{}]);
27 }
28 },
13 /* Mock EntryListWatcher */{}); 29 /* Mock EntryListWatcher */{});
14 fileSystem = new MockFileSystem('volumeId'); 30 fileSystem = new MockFileSystem('volumeId');
15 item = new Gallery.Item( 31 item = new Gallery.Item(
16 new MockEntry(fileSystem, '/test.jpg'), 32 new MockEntry(fileSystem, '/test.jpg'),
17 null, 33 null,
18 /* metadataItem */ {}, 34 /* metadataItem */ {},
19 /* thumbnailMetadataItem */ {}, 35 /* thumbnailMetadataItem */ {},
20 /* original */ true); 36 /* original */ true);
21 } 37 }
22 38
(...skipping 29 matching lines...) Expand all
52 // Gallery item track new file. 68 // Gallery item track new file.
53 this.entry_ = new MockEntry(fileSystem, '/test (1).jpg'); 69 this.entry_ = new MockEntry(fileSystem, '/test (1).jpg');
54 callback(true); 70 callback(true);
55 }; 71 };
56 model.push(item); 72 model.push(item);
57 reportPromise( 73 reportPromise(
58 model.saveItem({}, item, document.createElement('canvas'), false). 74 model.saveItem({}, item, document.createElement('canvas'), false).
59 then(function() { assertEquals(2, model.length); }), 75 then(function() { assertEquals(2, model.length); }),
60 callback); 76 callback);
61 } 77 }
OLDNEW
« no previous file with comments | « ui/file_manager/gallery/js/gallery_data_model.js ('k') | ui/file_manager/gallery/js/gallery_item.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698