Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 {imageData: canvas}, | |
| 12 {path: 'icon.png'}, | |
| 13 {imageData: {'19': canvas, '38': canvasHD}}, | |
| 14 {path: {'19': 'icon.png', '38': 'icon.png'}}, | |
| 15 {imageData: {'19': canvas}}, | |
|
Jeffrey Yasskin
2012/08/21 20:10:38
Would it be a good test to check only setting a 2x
tbarzic
2012/08/22 00:12:49
Done.
| |
| 16 {path: {'19': 'icon.png'}}, | |
| 17 ]; | |
| 18 | |
| 5 // Called when the user clicks on the browser action. | 19 // Called when the user clicks on the browser action. |
| 6 chrome.browserAction.onClicked.addListener(function(windowId) { | 20 chrome.browserAction.onClicked.addListener(function(windowId) { |
| 7 chrome.tabs.executeScript(null, {code:"document.body.bgColor='red'"}); | 21 if (setIconParamQueue.length == 0) { |
| 22 chrome.test.notifyFail("Queue of params for test cases unexpectedly empty"); | |
| 23 return; | |
| 24 } | |
| 25 | |
| 26 chrome.browserAction.setIcon(setIconParamQueue.shift(), function() { | |
| 27 chrome.test.notifyPass();}); | |
| 8 }); | 28 }); |
| 9 | 29 |
| 10 chrome.test.notifyPass(); | 30 chrome.test.notifyPass(); |
| OLD | NEW |