| 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..a68b47217f40b225f06cd083afce42ed1ff89ad9
|
| --- /dev/null
|
| +++ b/chrome/test/data/extensions/api_test/system_indicator/test.js
|
| @@ -0,0 +1,48 @@
|
| +// 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.
|
| +
|
| +// Idle api test for Chrome.
|
| +// browser_tests.exe --gtest_filter=ExtensionApiTest.SystemIndicator
|
| +
|
| +// Due to the fact that browser tests are run in many different environments it
|
| +// is not simple to be able to set the user input value before testing. For
|
| +// these bvts we have chosen the minimal consistent tests.
|
| +
|
| +chrome.test.runTests([
|
| + function showAndHideNonexistentIcon() {
|
| + // Hide before show, just in case
|
| + 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.setURL('128.png');
|
| + chrome.test.succeed();
|
| + },
|
| + function setImageData() {
|
| + // create an image, turn it into a canvas, then set the icon.
|
| + var img = new Image(),
|
| + path = '128.png';
|
| + img.onerror = function() {
|
| + console.error('Could not load icon \'' + path + '\'.');
|
| + chrome.test.fail();
|
| + };
|
| + img.onload = function() {
|
| + var canvas = document.createElement('canvas');
|
| + canvas.width = img.width;
|
| + canvas.height = img.height;
|
| +
|
| + var canvas_context = canvas.getContext('2d');
|
| + canvas_context.clearRect(0, 0, canvas.width, canvas.height);
|
| + canvas_context.drawImage(img, 0, 0, canvas.width, canvas.height);
|
| + var imageData = canvas_context.getImageData(0, 0, canvas.width,
|
| + canvas.height);
|
| + chrome.experimental.systemIndicator.setImageData(imageData);
|
| + chrome.test.succeed();
|
| + };
|
| + img.src = path;
|
| + }
|
| +]);
|
|
|