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

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

Issue 1984953005: Revert "Fix the browser crash when changing wallpaper with chrome.wallpaper API." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
90 chrome.test.runTests([ 77 chrome.test.runTests([
91 function setJpgWallpaperFromAppLocalFile() { 78 function setJpgWallpaperFromAppLocalFile() {
92 testSetWallpaperFromArrayBuffer('test.jpg'); 79 testSetWallpaperFromArrayBuffer('test.jpg');
93 }, 80 },
94 function setPngWallpaperFromAppLocalFile() { 81 function setPngWallpaperFromAppLocalFile() {
95 testSetWallpaperFromArrayBuffer('test.png'); 82 testSetWallpaperFromArrayBuffer('test.png');
96 }, 83 },
97 function setJpgWallpaperFromURL () { 84 function setJpgWallpaperFromURL () {
98 testSetWallpaperFromURL('test.jpg', true); 85 testSetWallpaperFromURL('test.jpg', true);
99 }, 86 },
(...skipping 10 matching lines...) Expand all
110 }, 97 },
111 function newRequestCancelPreviousRequest() { 98 function newRequestCancelPreviousRequest() {
112 // The first request should be canceled. The wallpaper in the first 99 // The first request should be canceled. The wallpaper in the first
113 // request is chosen from one of the high-resolution built-in wallpapers 100 // request is chosen from one of the high-resolution built-in wallpapers
114 // to make sure the first setWallpaper request hasn't finished yet when 101 // to make sure the first setWallpaper request hasn't finished yet when
115 // the second request sends out. 102 // the second request sends out.
116 testSetWallpaperFromURL('test_image_high_resolution.jpg', 103 testSetWallpaperFromURL('test_image_high_resolution.jpg',
117 false, 104 false,
118 'Set wallpaper was canceled.'); 105 'Set wallpaper was canceled.');
119 testSetWallpaperFromURL('test.jpg', true); 106 testSetWallpaperFromURL('test.jpg', true);
120 },
121 function getThumbnailAferSetWallpaper() {
122 testSetWallpaperThumbnail('test.jpg');
123 } 107 }
124 ]); 108 ]);
125 }); 109 });
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