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

Side by Side Diff: chrome/test/data/extensions/api_test/browser_action/no_icon/background.js

Issue 10855154: Update browserAction.setIcon and pageAction.setIcon for hidpi (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 canvas = document.getElementById("canvas").getContext('2d').
6 getImageData(0, 0, 19, 19);
7 var canvasHD = document.getElementById("canvas").getContext('2d').
8 getImageData(0, 0, 38, 38);
9
10 var setIconParamQueue = [
11 // First value just to setup test to a valid state where some action icon is
12 // set.
13 {path: 'icon.png'},
14 {imageData: canvas},
15 {path: 'icon.png'},
16 {imageDataSet: {'19': canvas, '38': canvasHD}},
17 {pathSet: {'19': 'icon.png', '38': 'icon.png'}},
18 {pathSet: {'19': 'icon.png', '38': 'icon.png'}},
19 ];
20
5 // Called when the user clicks on the browser action. 21 // Called when the user clicks on the browser action.
6 chrome.browserAction.onClicked.addListener(function(windowId) { 22 chrome.browserAction.onClicked.addListener(function(windowId) {
7 chrome.tabs.executeScript(null, {code:"document.body.bgColor='red'"}); 23 if (setIconParamQueue.length == 0) {
24 chrome.test.notifyFail("Queue of params for test cases unexpectedly empty");
25 return;
26 }
27 chrome.browserAction.setIcon(setIconParamQueue.shift(), function() {
28 chrome.test.notifyPass();});
8 }); 29 });
9 30
10 chrome.test.notifyPass(); 31 chrome.test.notifyPass();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698