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 * Mock of ImageUtil. | 6 * Mock of ImageUtil. |
7 */ | 7 */ |
8 var ImageUtil = { | 8 var ImageUtil = { |
9 getMetricName: function() {}, | 9 getMetricName: function() {}, |
10 metrics: { | 10 metrics: { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 }, | 56 }, |
57 clear: function(entries, type) { | 57 clear: function(entries, type) { |
58 fetchedMediaCleared = true; | 58 fetchedMediaCleared = true; |
59 } | 59 } |
60 }; | 60 }; |
61 var item = new Gallery.Item( | 61 var item = new Gallery.Item( |
62 entry, | 62 entry, |
63 {isReadOnly: false}, | 63 {isReadOnly: false}, |
64 {name: 'oldMetadata'}, | 64 {name: 'oldMetadata'}, |
65 metadataCache, | 65 metadataCache, |
| 66 // Mock of FileSystemMetadata. |
| 67 { |
| 68 get: function() { |
| 69 return Promise.resolve({}); |
| 70 }, |
| 71 notifyEntriesChanged: function() {} |
| 72 }, |
66 /* original */ true); | 73 /* original */ true); |
67 assertEquals('oldMetadata', item.getMetadata().name); | 74 assertEquals('oldMetadata', item.getMetadata().name); |
68 assertFalse(fetchedMediaCleared); | 75 assertFalse(fetchedMediaCleared); |
69 reportPromise( | 76 reportPromise( |
70 new Promise(item.saveToFile.bind( | 77 new Promise(item.saveToFile.bind( |
71 item, | 78 item, |
72 {getLocationInfo: function() { return {}; }}, | 79 {getLocationInfo: function() { return {}; }}, |
73 null, | 80 null, |
74 true, | 81 true, |
75 document.createElement('canvas'))).then(function() { | 82 document.createElement('canvas'))).then(function() { |
76 assertEquals('newMetadata', item.getMetadata().name); | 83 assertEquals('newMetadata', item.getMetadata().name); |
77 assertTrue(fetchedMediaCleared); | 84 assertTrue(fetchedMediaCleared); |
78 }), callback); | 85 }), callback); |
79 } | 86 } |
OLD | NEW |