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

Side by Side Diff: ui/file_manager/gallery/js/gallery_item_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: 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 /** 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 this.write(); 70 this.write();
71 } 71 }
72 }); 72 });
73 }; 73 };
74 var entryChanged = false; 74 var entryChanged = false;
75 var metadataModel = getMockMetadataModel(); 75 var metadataModel = getMockMetadataModel();
76 metadataModel.notifyEntriesChanged = function() { 76 metadataModel.notifyEntriesChanged = function() {
77 entryChanged = true; 77 entryChanged = true;
78 }; 78 };
79 79
80 var item = new Gallery.Item( 80 var item = new GalleryItem(
81 entry, 81 entry,
82 {isReadOnly: false}, 82 {isReadOnly: false},
83 {size: 100}, 83 {size: 100},
84 {}, 84 {},
85 /* original */ true); 85 /* original */ true);
86 assertEquals(100, item.getMetadataItem().size); 86 assertEquals(100, item.getMetadataItem().size);
87 assertFalse(entryChanged); 87 assertFalse(entryChanged);
88 reportPromise( 88 reportPromise(
89 new Promise(item.saveToFile.bind( 89 new Promise(item.saveToFile.bind(
90 item, 90 item,
(...skipping 27 matching lines...) Expand all
118 }.bind(this)); 118 }.bind(this));
119 }, 119 },
120 truncate: function() { 120 truncate: function() {
121 Promise.resolve().then(function() { 121 Promise.resolve().then(function() {
122 this.onwriteend(); 122 this.onwriteend();
123 }.bind(this)); 123 }.bind(this));
124 } 124 }
125 }); 125 });
126 }; 126 };
127 127
128 var item = new Gallery.Item( 128 var item = new GalleryItem(
129 entry, 129 entry,
130 {isReadOnly: false}, 130 {isReadOnly: false},
131 {size: 100}, 131 {size: 100},
132 {}, 132 {},
133 /* original */ true); 133 /* original */ true);
134 reportPromise( 134 reportPromise(
135 new Promise(item.saveToFile.bind( 135 new Promise(item.saveToFile.bind(
136 item, 136 item,
137 { 137 {
138 getLocationInfo: function() { return {}; }, 138 getLocationInfo: function() { return {}; },
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 }, 171 },
172 truncate: function() { 172 truncate: function() {
173 Promise.resolve().then(function() { 173 Promise.resolve().then(function() {
174 writeOperationRun = true; 174 writeOperationRun = true;
175 this.onwriteend(); 175 this.onwriteend();
176 }.bind(this)); 176 }.bind(this));
177 } 177 }
178 }); 178 });
179 }; 179 };
180 180
181 var item = new Gallery.Item( 181 var item = new GalleryItem(
182 entry, 182 entry,
183 {isReadOnly: false}, 183 {isReadOnly: false},
184 {size: 100}, 184 {size: 100},
185 {}, 185 {},
186 /* original */ true); 186 /* original */ true);
187 reportPromise( 187 reportPromise(
188 new Promise(item.saveToFile.bind( 188 new Promise(item.saveToFile.bind(
189 item, 189 item,
190 { 190 {
191 getLocationInfo: function() { return {}; }, 191 getLocationInfo: function() { return {}; },
(...skipping 30 matching lines...) Expand all
222 }; 222 };
223 } 223 }
224 MockDirectoryEntry.prototype.getFile.apply(this, arguments); 224 MockDirectoryEntry.prototype.getFile.apply(this, arguments);
225 }; 225 };
226 var entryChanged = false; 226 var entryChanged = false;
227 var metadataModel = getMockMetadataModel(); 227 var metadataModel = getMockMetadataModel();
228 metadataModel.notifyEntriesChanged = function() { 228 metadataModel.notifyEntriesChanged = function() {
229 entryChanged = true; 229 entryChanged = true;
230 }; 230 };
231 231
232 var item = new Gallery.Item( 232 var item = new GalleryItem(
233 fileSystem.entries['/test.arw'], 233 fileSystem.entries['/test.arw'],
234 {isReadOnly: false}, 234 {isReadOnly: false},
235 {size: 100}, 235 {size: 100},
236 {}, 236 {},
237 /* original */ true); 237 /* original */ true);
238 assertEquals(100, item.getMetadataItem().size); 238 assertEquals(100, item.getMetadataItem().size);
239 assertFalse(entryChanged); 239 assertFalse(entryChanged);
240 reportPromise( 240 reportPromise(
241 new Promise(item.saveToFile.bind( 241 new Promise(item.saveToFile.bind(
242 item, 242 item,
(...skipping 26 matching lines...) Expand all
269 // Mock volume manager. 269 // Mock volume manager.
270 var volumeManager = { 270 var volumeManager = {
271 getVolumeInfo: function(entry) { 271 getVolumeInfo: function(entry) {
272 return { 272 return {
273 volumeType: volumeTypes[entry.filesystem.name] 273 volumeType: volumeTypes[entry.filesystem.name]
274 }; 274 };
275 } 275 }
276 }; 276 };
277 277
278 var getGalleryItem = function(path, fileSystem, isReadOnly) { 278 var getGalleryItem = function(path, fileSystem, isReadOnly) {
279 return new Gallery.Item(new MockEntry(fileSystem, path), 279 return new GalleryItem(new MockEntry(fileSystem, path),
280 {isReadOnly: isReadOnly}, 280 {isReadOnly: isReadOnly},
281 {size: 100}, 281 {size: 100},
282 {}, 282 {},
283 true /* original */); 283 true /* original */);
284 }; 284 };
285 285
286 // Jpeg file on downloads. 286 // Jpeg file on downloads.
287 assertTrue(getGalleryItem( 287 assertTrue(getGalleryItem(
288 '/test.jpg', downloads, false /* not read only */). 288 '/test.jpg', downloads, false /* not read only */).
289 isWritableFile(volumeManager)); 289 isWritableFile(volumeManager));
(...skipping 11 matching lines...) Expand all
301 // Jpeg file on non-writable volume. 301 // Jpeg file on non-writable volume.
302 assertFalse(getGalleryItem( 302 assertFalse(getGalleryItem(
303 '/test.jpg', removable, true /* read only */). 303 '/test.jpg', removable, true /* read only */).
304 isWritableFile(volumeManager)); 304 isWritableFile(volumeManager));
305 305
306 // Jpeg file on mtp volume. 306 // Jpeg file on mtp volume.
307 assertFalse(getGalleryItem( 307 assertFalse(getGalleryItem(
308 '/test.jpg', mtp, false /* not read only */). 308 '/test.jpg', mtp, false /* not read only */).
309 isWritableFile(volumeManager)); 309 isWritableFile(volumeManager));
310 }; 310 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698