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. | 66 // Mock of MetadataModel. |
67 { | 67 { |
68 get: function() { | 68 get: function() { |
69 return Promise.resolve([{}]); | 69 return Promise.resolve([{}]); |
70 }, | 70 }, |
71 notifyEntriesChanged: function() {} | 71 notifyEntriesChanged: function() {} |
72 }, | 72 }, |
73 /* original */ true); | 73 /* original */ true); |
74 assertEquals('oldMetadata', item.getMetadata().name); | 74 assertEquals('oldMetadata', item.getMetadata().name); |
75 assertFalse(fetchedMediaCleared); | 75 assertFalse(fetchedMediaCleared); |
76 reportPromise( | 76 reportPromise( |
77 new Promise(item.saveToFile.bind( | 77 new Promise(item.saveToFile.bind( |
78 item, | 78 item, |
79 {getLocationInfo: function() { return {}; }}, | 79 {getLocationInfo: function() { return {}; }}, |
80 null, | 80 null, |
81 true, | 81 true, |
82 document.createElement('canvas'))).then(function() { | 82 document.createElement('canvas'))).then(function() { |
83 assertEquals('newMetadata', item.getMetadata().name); | 83 assertEquals('newMetadata', item.getMetadata().name); |
84 assertTrue(fetchedMediaCleared); | 84 assertTrue(fetchedMediaCleared); |
85 }), callback); | 85 }), callback); |
86 } | 86 } |
OLD | NEW |