| 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 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |