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

Side by Side Diff: chrome/test/data/extensions/api_test/wallpaper/test.js

Issue 1989653002: [Retry] Fix the browser crash when changing wallpaper with chrome.wallpaper API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/chromeos/extensions/wallpaper_api.cc ('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 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 var pass = chrome.test.callbackPass; 5 var pass = chrome.test.callbackPass;
6 var fail = chrome.test.callbackFail; 6 var fail = chrome.test.callbackFail;
7 7
8 chrome.test.getConfig(function(config) { 8 chrome.test.getConfig(function(config) {
9 9
10 var baseURL = "http://a.com:" + config.testServer.port + 10 var baseURL = "http://a.com:" + config.testServer.port +
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } 67 }
68 chrome.wallpaper.setWallpaper( 68 chrome.wallpaper.setWallpaper(
69 {'url': url, 69 {'url': url,
70 'layout': 'CENTER_CROPPED', 70 'layout': 'CENTER_CROPPED',
71 'filename': 'test'}, 71 'filename': 'test'},
72 // Expect a failure. 72 // Expect a failure.
73 fail(optExpectedError)); 73 fail(optExpectedError));
74 } 74 }
75 }; 75 };
76 76
77 var testSetWallpaperThumbnail = function(relativeURL) {
78 var url = baseURL + relativeURL;
79 chrome.wallpaper.setWallpaper(
80 { 'url': url,
81 'layout': 'CENTER_CROPPED',
82 'filename': 'test',
83 'thumbnail': true
84 }, pass(function(thumbnail) {
85 var buffer = new Uint8Array(thumbnail);
86 chrome.test.assertTrue(buffer.length > 0);
87 }));
88 };
89
77 chrome.test.runTests([ 90 chrome.test.runTests([
78 function setJpgWallpaperFromAppLocalFile() { 91 function setJpgWallpaperFromAppLocalFile() {
79 testSetWallpaperFromArrayBuffer('test.jpg'); 92 testSetWallpaperFromArrayBuffer('test.jpg');
80 }, 93 },
81 function setPngWallpaperFromAppLocalFile() { 94 function setPngWallpaperFromAppLocalFile() {
82 testSetWallpaperFromArrayBuffer('test.png'); 95 testSetWallpaperFromArrayBuffer('test.png');
83 }, 96 },
84 function setJpgWallpaperFromURL () { 97 function setJpgWallpaperFromURL () {
85 testSetWallpaperFromURL('test.jpg', true); 98 testSetWallpaperFromURL('test.jpg', true);
86 }, 99 },
(...skipping 10 matching lines...) Expand all
97 }, 110 },
98 function newRequestCancelPreviousRequest() { 111 function newRequestCancelPreviousRequest() {
99 // The first request should be canceled. The wallpaper in the first 112 // The first request should be canceled. The wallpaper in the first
100 // request is chosen from one of the high-resolution built-in wallpapers 113 // request is chosen from one of the high-resolution built-in wallpapers
101 // to make sure the first setWallpaper request hasn't finished yet when 114 // to make sure the first setWallpaper request hasn't finished yet when
102 // the second request sends out. 115 // the second request sends out.
103 testSetWallpaperFromURL('test_image_high_resolution.jpg', 116 testSetWallpaperFromURL('test_image_high_resolution.jpg',
104 false, 117 false,
105 'Set wallpaper was canceled.'); 118 'Set wallpaper was canceled.');
106 testSetWallpaperFromURL('test.jpg', true); 119 testSetWallpaperFromURL('test.jpg', true);
120 },
121 function getThumbnailAferSetWallpaper() {
122 testSetWallpaperThumbnail('test.jpg');
107 } 123 }
108 ]); 124 ]);
109 }); 125 });
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/wallpaper_api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698