1 // Copyright (c) 2012 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.
5 var pass = chrome.test.callbackPass;
7 chrome.tabs.getSelected(null, function(tab) {
8 chrome.browserAction.setPopup({tabId: tab.id, popup: 'newPopup.html'})
9 chrome.browserAction.setTitle({tabId: tab.id, title: 'newTitle'});
10 chrome.browserAction.setBadgeBackgroundColor({
14 chrome.browserAction.setBadgeText({tabId: tab.id, text: 'newText'});
16 chrome.test.runTests([
17 function getBadgeText() {
18 chrome.browserAction.getBadgeText({tabId: tab.id}, pass(function(result) {
19 chrome.test.assertEq("newText", result);
23 function getBadgeBackgroundColor() {
24 chrome.browserAction.getBadgeBackgroundColor({tabId: tab.id},
25 pass(function(result) {
26 chrome.test.assertEq([0, 0, 0, 0], result);
31 chrome.browserAction.getPopup({tabId: tab.id}, pass(function(result) {
32 chrome.test.assertTrue(
33 /chrome-extension\:\/\/[a-p]{32}\/newPopup\.html/.test(result));
38 chrome.browserAction.getTitle({tabId: tab.id}, pass(function(result) {
39 chrome.test.assertEq("newTitle", result);