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

Side by Side Diff: ui/file_manager/file_manager/foreground/js/thumbnail_loader_unittest.js

Issue 2700073003: Take the rotation information from the right source. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « ui/file_manager/file_manager/foreground/js/thumbnail_loader.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 function getLoadTarget(entry, metadata) { 5 function getLoadTarget(entry, metadata) {
6 return new ThumbnailLoader(entry, null, metadata).getLoadTarget(); 6 return new ThumbnailLoader(entry, null, metadata).getLoadTarget();
7 } 7 }
8 8
9 /** 9 /**
10 * Generates a data url of a sample image for testing. 10 * Generates a data url of a sample image for testing.
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 assertEquals(externalThumbnailDataUrl, result.data); 168 assertEquals(externalThumbnailDataUrl, result.data);
169 }), callback); 169 }), callback);
170 } 170 }
171 171
172 function testLoadDetachedFromExifInCavnasModeThumbnailDoesNotRotate(callback) { 172 function testLoadDetachedFromExifInCavnasModeThumbnailDoesNotRotate(callback) {
173 ImageLoaderClient.getInstance = function() { 173 ImageLoaderClient.getInstance = function() {
174 return { 174 return {
175 load: function(url, callback, opt_option) { 175 load: function(url, callback, opt_option) {
176 // Assert that data url is passed. 176 // Assert that data url is passed.
177 assertTrue(/^data:/i.test(url)); 177 assertTrue(/^data:/i.test(url));
178 // Assert that the rotation is propagated to ImageLoader.
179 assertEquals(1, opt_option.orientation.rotate90);
178 // ImageLoader returns rotated image. 180 // ImageLoader returns rotated image.
179 callback({status: 'success', data: generateSampleImageDataUrl(32, 64), 181 callback({status: 'success', data: generateSampleImageDataUrl(32, 64),
180 width: 32, height: 64}); 182 width: 32, height: 64});
181 } 183 }
182 }; 184 };
183 }; 185 };
184 186
185 var metadata = { 187 var metadata = {
186 thumbnail: { 188 thumbnail: {
187 url: generateSampleImageDataUrl(64, 32), 189 url: generateSampleImageDataUrl(64, 32),
(...skipping 13 matching lines...) Expand all
201 reportPromise( 203 reportPromise(
202 new Promise(function(resolve, reject) { 204 new Promise(function(resolve, reject) {
203 thumbnailLoader.loadDetachedImage(resolve); 205 thumbnailLoader.loadDetachedImage(resolve);
204 }).then(function() { 206 }).then(function() {
205 var image = thumbnailLoader.getImage(); 207 var image = thumbnailLoader.getImage();
206 // No need to rotate by loadDetachedImage() as it's already done. 208 // No need to rotate by loadDetachedImage() as it's already done.
207 assertEquals(32, image.width); 209 assertEquals(32, image.width);
208 assertEquals(64, image.height); 210 assertEquals(64, image.height);
209 }), callback); 211 }), callback);
210 } 212 }
OLDNEW
« no previous file with comments | « ui/file_manager/file_manager/foreground/js/thumbnail_loader.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698