Index: chrome/test/data/extensions/api_test/system_indicator/test.js |
diff --git a/chrome/test/data/extensions/api_test/system_indicator/test.js b/chrome/test/data/extensions/api_test/system_indicator/test.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1f4f4c060fe6d57c2c8f991c388c4a0c430de0e9 |
--- /dev/null |
+++ b/chrome/test/data/extensions/api_test/system_indicator/test.js |
@@ -0,0 +1,72 @@ |
+// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+// System indicator test for Chrome. |
+// browser_tests.exe --gtest_filter=ExtensionApiTest.SystemIndicator |
+ |
+chrome.test.runTests([ |
+ function showAndHideNonexistentIcon() { |
+ // 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
|
+ chrome.experimental.systemIndicator.hide(); |
+ chrome.experimental.systemIndicator.show(); |
+ chrome.experimental.systemIndicator.hide(); |
+ chrome.test.succeed(); |
+ }, |
+ function setUrl() { |
+ // Success in showing the icon? |
+ chrome.experimental.systemIndicator.setIconURL('128.png'); |
+ chrome.test.succeed(); |
+ }, |
+ function setImageData() { |
+ // 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
|
+ var canvas = document.createElement('canvas'); |
+ canvas.width = 20; |
+ canvas.height = 20; |
+ |
+ var canvas_context = canvas.getContext('2d'); |
+ canvas_context.clearRect(0, 0, 20, 20); |
+ canvas_context.fillStyle = '#00FF00'; |
+ canvas_context.fillRect(5, 5, 15, 15); |
+ var imageData = canvas_context.getImageData(0, 0, 20, 20); |
+ chrome.experimental.systemIndicator.setIconData([imageData]); |
+ chrome.test.succeed(); |
+ }, |
+ function setEmptyImageData() { |
+ // set empty menu |
jianli
2012/11/14 19:27:41
nit: ditto
dewittj
2012/11/16 00:56:28
Fixed.
|
+ chrome.experimental.systemIndicator.setIconData([]); |
+ chrome.test.succeed(); |
+ }, |
+ function setMenu() { |
+ chrome.experimental.systemIndicator.setMenu({ |
+ nodes: [ |
+ { |
+ type: 'normal', |
+ id: 'first', |
+ title: 'Test Menu Item 1' |
+ }, |
+ { |
+ type: 'separator', |
+ id: 'second' |
+ }, |
+ { |
+ type: 'normal', |
+ id: 'third', |
+ title: 'Test Menu Item 2' |
+ }, |
+ { |
+ type: 'normal', |
+ id: 'fourth', |
+ title: 'Test Menu Item 3' |
+ }, |
+ { |
+ type: 'normal', |
+ id: 'fifth', |
+ title: 'Test Menu Item 4' |
+ } |
+ ] |
+ }); |
+ chrome.experimental.systemIndicator.show(); |
+ chrome.test.succeed(); |
+ } |
+]); |