- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / test / data / extensions / api_test / permissions / disabled / background.js
1 // Copyright (c) 2011 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 // All of the calls to chrome.* functions should fail, with the exception of
6 // chrome.tabs.*, since this extension has requested no permissions.
7
8 chrome.test.runTests([
9   function history() {
10     try {
11       var query = { 'text': '', 'maxResults': 1 };
12       chrome.history.search(query, function(results) {
13         chrome.test.fail();
14       });
15     } catch (e) {
16       chrome.test.succeed();
17     }
18   },
19
20   function bookmarks() {
21     try {
22       chrome.bookmarks.get("1", function(results) {
23         chrome.test.fail();
24       });
25     } catch (e) {
26       chrome.test.succeed();
27     }
28   },
29
30   // Tabs functionality should be enabled even if the tabs permissions are not
31   // present.
32   function tabs() {
33     try {
34       chrome.tabs.create({'url': '1'}, function(tab) {
35         // Tabs strip sensitive data without permissions.
36         chrome.test.assertFalse('url' in tab);
37         chrome.test.succeed();
38       });
39     } catch (e) {
40       chrome.test.fail();
41     }
42   },
43
44   function idle() {
45     try {
46       chrome.idle.queryState(60, function(state) {
47         chrome.test.fail();
48       });
49     } catch (e) {
50       chrome.test.succeed();
51     }
52   }
53 ]);