- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / test / data / extensions / api_test / browser_action / getters / update2.js
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.
4
5 var pass = chrome.test.callbackPass;
6
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({
11     tabId: tab.id,
12     color: [0, 0, 0, 0]
13   });
14   chrome.browserAction.setBadgeText({tabId: tab.id, text: 'newText'});
15
16   chrome.test.runTests([
17     function getBadgeText() {
18       chrome.browserAction.getBadgeText({tabId: tab.id}, pass(function(result) {
19         chrome.test.assertEq("newText", result);
20       }));
21     },
22
23     function getBadgeBackgroundColor() {
24       chrome.browserAction.getBadgeBackgroundColor({tabId: tab.id},
25                                                    pass(function(result) {
26         chrome.test.assertEq([0, 0, 0, 0], result);
27       }));
28     },
29
30     function getPopup() {
31       chrome.browserAction.getPopup({tabId: tab.id}, pass(function(result) {
32         chrome.test.assertTrue(
33             /chrome-extension\:\/\/[a-p]{32}\/newPopup\.html/.test(result));
34       }));
35     },
36
37     function getTitle() {
38       chrome.browserAction.getTitle({tabId: tab.id}, pass(function(result) {
39         chrome.test.assertEq("newTitle", result);
40       }));
41     }
42   ]);
43 });