Chromium Code Reviews| Index: chrome/test/data/extensions/api_test/wallpaper_manager/test.js |
| diff --git a/chrome/test/data/extensions/api_test/wallpaper_manager/test.js b/chrome/test/data/extensions/api_test/wallpaper_manager/test.js |
| index 99385bcfdb9cf58cf6e8f87be2ea431fddce258d..c274617cf4717a8063e26622319434c7d4431a64 100644 |
| --- a/chrome/test/data/extensions/api_test/wallpaper_manager/test.js |
| +++ b/chrome/test/data/extensions/api_test/wallpaper_manager/test.js |
| @@ -9,7 +9,8 @@ var pass = chrome.test.callbackPass; |
| var fail = chrome.test.callbackFail; |
| chrome.test.getConfig(function(config) { |
| - var wallpaper; |
| + var wallpaperJpeg; |
| + var wallpaperPng; |
| var wallpaperStrings; |
| var requestImage = function(url, onLoadCallback) { |
| var wallpaperRequest = new XMLHttpRequest(); |
| @@ -37,8 +38,8 @@ chrome.test.getConfig(function(config) { |
| url = url.replace(/PORT/, config.testServer.port); |
| requestImage(url, function(requestStatus, response) { |
| if (requestStatus === 200) { |
| - wallpaper = response; |
| - chrome.wallpaperPrivate.setWallpaper(wallpaper, |
| + wallpaperJpeg = response; |
| + chrome.wallpaperPrivate.setWallpaper(wallpaperJpeg, |
| 'CENTER_CROPPED', |
| url, |
| pass(function() { |
| @@ -51,7 +52,7 @@ chrome.test.getConfig(function(config) { |
| }); |
| }, |
| function setCustomJpegWallpaper() { |
| - chrome.wallpaperPrivate.setCustomWallpaper(wallpaper, |
| + chrome.wallpaperPrivate.setCustomWallpaper(wallpaperJpeg, |
| 'CENTER_CROPPED', |
| true, |
| '123', |
| @@ -62,15 +63,28 @@ chrome.test.getConfig(function(config) { |
| })); |
| })); |
| }, |
| - function getCustomWallpaperThumbnail() { |
|
bshe
2013/06/11 22:16:21
getOfflineWallpaperList is no longer needed for cu
|
| - chrome.wallpaperPrivate.getOfflineWallpaperList('CUSTOM', |
| - pass(function(lists) { |
| - chrome.test.assertEq(1, lists.length); |
| - chrome.wallpaperPrivate.getThumbnail(lists[0], 'CUSTOM', |
| - pass(function(data) { |
| - chrome.test.assertNoLastError(); |
| - })); |
| - })); |
| + function setCustomPngWallpaper() { |
| + var url = "http://a.com:PORT/files/extensions/api_test" + |
| + "/wallpaper_manager/test.png"; |
| + url = url.replace(/PORT/, config.testServer.port); |
| + requestImage(url, function(requestStatus, response) { |
| + if (requestStatus === 200) { |
| + wallpaperPng = response; |
| + chrome.wallpaperPrivate.setCustomWallpaper(wallpaperPng, |
| + 'CENTER_CROPPED', |
| + true, |
| + '123', |
| + pass(function(thumbnail) { |
| + chrome.wallpaperPrivate.setCustomWallpaperLayout('CENTER', |
| + pass(function() { |
| + chrome.wallpaperPrivate.setCustomWallpaperLayout('STRETCH', |
| + pass()); |
| + })); |
| + })); |
| + } else { |
| + chrome.test.fail('Failed to load test.png from local server.'); |
| + } |
| + }); |
| }, |
| function setCustomJepgBadWallpaper() { |
| var url = "http://a.com:PORT/files/extensions/api_test" + |
| @@ -110,13 +124,14 @@ chrome.test.getConfig(function(config) { |
| chrome.test.fail('Thumbnail is not found. getThumbnail should not ' + |
| 'return any data.'); |
| } |
| - chrome.wallpaperPrivate.saveThumbnail(url, wallpaper, pass(function() { |
| + chrome.wallpaperPrivate.saveThumbnail(url, wallpaperJpeg, |
| + pass(function() { |
| chrome.test.assertNoLastError(); |
| chrome.wallpaperPrivate.getThumbnail(url, 'ONLINE', |
| pass(function(data) { |
| chrome.test.assertNoLastError(); |
| // Thumbnail should already be saved to thumbnail directory. |
| - chrome.test.assertEq(wallpaper, data); |
| + chrome.test.assertEq(wallpaperJpeg, data); |
| })); |
| })); |
| })); |
| @@ -128,7 +143,7 @@ chrome.test.getConfig(function(config) { |
| chrome.test.assertEq('test.jpg', list[0]); |
| // Saves the same wallpaper to wallpaper directory but name it as |
| // test1.jpg. |
| - chrome.wallpaperPrivate.setWallpaper(wallpaper, |
| + chrome.wallpaperPrivate.setWallpaper(wallpaperJpeg, |
| 'CENTER_CROPPED', |
| 'http://dummyurl/test1.jpg', |
| pass(function() { |