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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/browser_action/no_icon/background.js
diff --git a/chrome/test/data/extensions/api_test/browser_action/no_icon/background.js b/chrome/test/data/extensions/api_test/browser_action/no_icon/background.js
index 41609111d986ab0064f455e89ca4a3bef1313d06..a05368b4d699273756e6e3b201f767b492e9e9b0 100644
--- a/chrome/test/data/extensions/api_test/browser_action/no_icon/background.js
+++ b/chrome/test/data/extensions/api_test/browser_action/no_icon/background.js
@@ -2,9 +2,30 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+var canvas = document.getElementById("canvas").getContext('2d').
+ getImageData(0, 0, 19, 19);
+var canvasHD = document.getElementById("canvas").getContext('2d').
+ getImageData(0, 0, 38, 38);
+
+var setIconParamQueue = [
+ // First value just to setup test to a valid state where some action icon is
+ // set.
+ {path: 'icon.png'},
+ {imageData: canvas},
+ {path: 'icon.png'},
+ {imageDataSet: {'19': canvas, '38': canvasHD}},
+ {pathSet: {'19': 'icon.png', '38': 'icon.png'}},
+ {pathSet: {'19': 'icon.png', '38': 'icon.png'}},
+];
+
// Called when the user clicks on the browser action.
chrome.browserAction.onClicked.addListener(function(windowId) {
- chrome.tabs.executeScript(null, {code:"document.body.bgColor='red'"});
+ if (setIconParamQueue.length == 0) {
+ chrome.test.notifyFail("Queue of params for test cases unexpectedly empty");
+ return;
+ }
+ chrome.browserAction.setIcon(setIconParamQueue.shift(), function() {
+ chrome.test.notifyPass();});
});
chrome.test.notifyPass();

Powered by Google App Engine
This is Rietveld 408576698