OLD | NEW |
---|---|
(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 chrome.test.runTests([ | |
9 function showAndHideNonexistentIcon() { | |
10 // Hide before show, just in case | |
jianli
2012/11/14 19:27:41
nit: end with period
dewittj
2012/11/16 00:56:28
Fixed
| |
11 chrome.experimental.systemIndicator.hide(); | |
12 chrome.experimental.systemIndicator.show(); | |
13 chrome.experimental.systemIndicator.hide(); | |
14 chrome.test.succeed(); | |
15 }, | |
16 function setUrl() { | |
17 // Success in showing the icon? | |
18 chrome.experimental.systemIndicator.setIconURL('128.png'); | |
19 chrome.test.succeed(); | |
20 }, | |
21 function setImageData() { | |
22 // create a canvas, then set the icon using it. | |
jianli
2012/11/14 19:27:41
nit: capitalize "create"
dewittj
2012/11/16 00:56:28
Fixed
| |
23 var canvas = document.createElement('canvas'); | |
24 canvas.width = 20; | |
25 canvas.height = 20; | |
26 | |
27 var canvas_context = canvas.getContext('2d'); | |
28 canvas_context.clearRect(0, 0, 20, 20); | |
29 canvas_context.fillStyle = '#00FF00'; | |
30 canvas_context.fillRect(5, 5, 15, 15); | |
31 var imageData = canvas_context.getImageData(0, 0, 20, 20); | |
32 chrome.experimental.systemIndicator.setIconData([imageData]); | |
33 chrome.test.succeed(); | |
34 }, | |
35 function setEmptyImageData() { | |
36 // set empty menu | |
jianli
2012/11/14 19:27:41
nit: ditto
dewittj
2012/11/16 00:56:28
Fixed.
| |
37 chrome.experimental.systemIndicator.setIconData([]); | |
38 chrome.test.succeed(); | |
39 }, | |
40 function setMenu() { | |
41 chrome.experimental.systemIndicator.setMenu({ | |
42 nodes: [ | |
43 { | |
44 type: 'normal', | |
45 id: 'first', | |
46 title: 'Test Menu Item 1' | |
47 }, | |
48 { | |
49 type: 'separator', | |
50 id: 'second' | |
51 }, | |
52 { | |
53 type: 'normal', | |
54 id: 'third', | |
55 title: 'Test Menu Item 2' | |
56 }, | |
57 { | |
58 type: 'normal', | |
59 id: 'fourth', | |
60 title: 'Test Menu Item 3' | |
61 }, | |
62 { | |
63 type: 'normal', | |
64 id: 'fifth', | |
65 title: 'Test Menu Item 4' | |
66 } | |
67 ] | |
68 }); | |
69 chrome.experimental.systemIndicator.show(); | |
70 chrome.test.succeed(); | |
71 } | |
72 ]); | |
OLD | NEW |