OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |