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

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

Issue 11361189: Initial skeleton for System Indicator API (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add manifest parsing and integrate with extension action api handlers. Created 8 years 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
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // System indicator test for Chrome.
6 // browser_tests.exe --gtest_filter=ExtensionApiTest.SystemIndicator
7
8 var callback = function() {
9 if (chrome.runtime.lastError) {
10 console.log('Error detected:' + chrome.runtime.lastError);
11 chrome.test.fail();
12 } else {
13 chrome.test.succeed();
14 }
15 };
16
not at google - send to devlin 2012/11/21 23:39:23 I'm not really sure what the added value of these
dewittj 2012/11/26 18:32:58 Okay, I'll simplify the tests so that it just trie
17 chrome.test.runTests([
18 function enableAndDisableNonexistentIcon() {
19 // Disable before enable, just in case.
20 chrome.systemIndicator.disable();
21 chrome.systemIndicator.enable();
22 chrome.systemIndicator.disable();
23 chrome.test.succeed();
24 },
25
26 // TODO(dewittj) Add binary files and enable these tests.
27 // function setUrl() {
28 // chrome.systemIndicator.setIcon({path: 'sample-19.png'}, callback);
29 // },
30 // function setMultiUrl() {
31 // var multiUrl = { '19': 'sample-19.png', '38': 'sample-38.png'};
32 // chrome.systemIndicator.setIcon({path: multiUrl}, callback);
33 // },
34
35 function setImageData() {
36 // Create a canvas, then set the icon using it.
37 var canvas = document.createElement('canvas');
38 canvas.width = 20;
39 canvas.height = 20;
40
41 var canvas_context = canvas.getContext('2d');
42 canvas_context.clearRect(0, 0, 20, 20);
43 canvas_context.fillStyle = '#00FF00';
44 canvas_context.fillRect(5, 5, 15, 15);
45 var data = canvas_context.getImageData(0, 0, 19, 19);
46 chrome.systemIndicator.setIcon({ imageData: data }, callback);
47 },
48 function setMultiImageData() {
49 // Create a canvas, then set the icon using it, and pass in multiple scales.
50 var canvas = document.createElement('canvas');
51 canvas.width = 20;
52 canvas.height = 20;
53
54 var canvas_context = canvas.getContext('2d');
55 canvas_context.clearRect(0, 0, 40, 40);
56 canvas_context.fillStyle = '#00FF00';
57 canvas_context.fillRect(5, 5, 15, 15);
58 var data = canvas_context.getImageData(0, 0, 19, 19);
59 var data2x = canvas_context.getImageData(0, 0, 38, 38);
60 var multiImageData = {
61 '19': data,
62 '38': data2x
63 };
64 chrome.systemIndicator.setIcon({ imageData: multiImageData }, callback);
65 },
66 function setEmptyImageData() {
67 var ok = false;
68 try {
69 chrome.systemIndicator.setIcon({});
70 } catch (e) {
71 chrome.test.succeed();
72 return;
73 }
74 chrome.test.fail();
75 }
76 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698