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

Unified Diff: ui/file_manager/gallery/js/gallery_item_unittest.js

Issue 1053653003: Gallery: Support RAW files in Gallery. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix the second bind. Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/file_manager/gallery/js/gallery_item_unittest.html ('k') | ui/file_manager/gallery/js/gallery_util.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/gallery/js/gallery_item_unittest.js
diff --git a/ui/file_manager/gallery/js/gallery_item_unittest.js b/ui/file_manager/gallery/js/gallery_item_unittest.js
index a5f487cd112e29a39cea5f4d986846f0801722b6..32052598f0e52d8a1235934e2ac691b269dd03cf 100644
--- a/ui/file_manager/gallery/js/gallery_item_unittest.js
+++ b/ui/file_manager/gallery/js/gallery_item_unittest.js
@@ -190,3 +190,55 @@ function testSaveToFileGetBlobFailCase(callback) {
assertFalse(writeOperationRun);
}), callback);
}
+
+function testSaveToFileRaw(callback) {
+ var fileSystem = new MockFileSystem('volumeId');
+ fileSystem.populate(['/test.arw']);
+ fileSystem.entries['/'].getFile = function(name, options, success, error) {
+ if (options.create) {
+ assertEquals('test - Edited.jpg', name);
+ fileSystem.populate(['/test - Edited.jpg']);
+ var entry = fileSystem.entries['/test - Edited.jpg'];
+ entry.createWriter = function(callback) {
+ callback({
+ write: function() {
+ Promise.resolve().then(function() {
+ this.onwriteend();
+ }.bind(this));
+ },
+ truncate: function() {
+ this.write();
+ }
+ });
+ };
+ }
+ MockDirectoryEntry.prototype.getFile.apply(this, arguments);
+ };
+ var entryChanged = false;
+ var metadataModel = getMockMetadataModel();
+ metadataModel.notifyEntriesChanged = function() {
+ entryChanged = true;
+ };
+
+ var item = new Gallery.Item(
+ fileSystem.entries['/test.arw'],
+ {isReadOnly: false},
+ {size: 100},
+ {},
+ /* original */ true);
+ assertEquals(100, item.getMetadataItem().size);
+ assertFalse(entryChanged);
+ reportPromise(
+ new Promise(item.saveToFile.bind(
+ item,
+ {getLocationInfo: function() { return {}; }},
+ metadataModel,
+ /* fallbackDir */ null,
+ /* overwrite is true but ignored */ true,
+ document.createElement('canvas'))).then(function(success) {
+ assertTrue(success);
+ assertEquals(200, item.getMetadataItem().size);
+ assertTrue(entryChanged);
+ assertFalse(item.isOriginal());
+ }), callback);
+}
« no previous file with comments | « ui/file_manager/gallery/js/gallery_item_unittest.html ('k') | ui/file_manager/gallery/js/gallery_util.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698