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

Unified Diff: chrome/test/data/extensions/api_test/wallpaper_manager/test.js

Issue 16634016: Support png wallpapers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: spelling Created 7 years, 6 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 | « chrome/browser/resources/chromeos/wallpaper_manager/main.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
- 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() {
« no previous file with comments | « chrome/browser/resources/chromeos/wallpaper_manager/main.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698