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

Side by Side Diff: ui/file_manager/image_loader/image_loader_client_unittest.js

Issue 890313002: Change ImageLoaderClient to return width and height of image. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test case. Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 'use strict'; 5 'use strict';
6 6
7 var chrome = { 7 var chrome = {
8 metricsPrivate: { 8 metricsPrivate: {
9 recordPercentage: function() {}, 9 recordPercentage: function() {},
10 recordValue: function() {} 10 recordValue: function() {}
(...skipping 11 matching lines...) Expand all
22 * @param {string} url URL 22 * @param {string} url URL
23 * @param {Object} options load options. 23 * @param {Object} options load options.
24 * @return {Promise<boolean>} True if the local cache is used. 24 * @return {Promise<boolean>} True if the local cache is used.
25 */ 25 */
26 function loadAndCheckCacheUsed(client, url, options) { 26 function loadAndCheckCacheUsed(client, url, options) {
27 var cacheUsed = true; 27 var cacheUsed = true;
28 28
29 ImageLoaderClient.sendMessage_ = function(message, callback) { 29 ImageLoaderClient.sendMessage_ = function(message, callback) {
30 cacheUsed = false; 30 cacheUsed = false;
31 if (callback) 31 if (callback)
32 callback({data: 'ImageData', status: 'success'}); 32 callback({data: 'ImageData', width: 100, height: 100, status: 'success'});
33 }; 33 };
34 34
35 return new Promise(function(fulfill) { 35 return new Promise(function(fulfill) {
36 client.load(url, function() { 36 client.load(url, function() {
37 fulfill(cacheUsed); 37 fulfill(cacheUsed);
38 }, options); 38 }, options);
39 }); 39 });
40 } 40 }
41 41
42 function testCache(callback) { 42 function testCache(callback) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 loadAndCheckCacheUsed(client, 'data:URI', {cache: true}). 77 loadAndCheckCacheUsed(client, 'data:URI', {cache: true}).
78 then(function(cacheUsed) { 78 then(function(cacheUsed) {
79 assertFalse(cacheUsed); 79 assertFalse(cacheUsed);
80 return loadAndCheckCacheUsed(client, 'data:URI', {cache: true}); 80 return loadAndCheckCacheUsed(client, 'data:URI', {cache: true});
81 }). 81 }).
82 then(function(cacheUsed) { 82 then(function(cacheUsed) {
83 assertFalse(cacheUsed); 83 assertFalse(cacheUsed);
84 }), 84 }),
85 callback); 85 callback);
86 } 86 }
OLDNEW
« no previous file with comments | « ui/file_manager/image_loader/image_loader_client.js ('k') | ui/file_manager/image_loader/request.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698