OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var assertFalse = chrome.test.assertFalse; | 5 var assertFalse = chrome.test.assertFalse; |
6 var assertTrue = chrome.test.assertTrue; | 6 var assertTrue = chrome.test.assertTrue; |
7 var assertEq = chrome.test.assertEq; | 7 var assertEq = chrome.test.assertEq; |
8 var pass = chrome.test.callbackPass; | 8 var pass = chrome.test.callbackPass; |
9 | 9 |
10 var NO_BOOKMARKS_PERMISSION = | 10 var NO_BOOKMARKS_PERMISSION = |
11 "You do not have permission to use 'bookmarks.getTree'."; | 11 "You do not have permission to use 'bookmarks.getTree'."; |
12 | 12 |
13 chrome.test.getConfig(function(config) { | 13 chrome.test.getConfig(function(config) { |
14 | 14 |
15 function doReq(domain, callback) { | 15 function doReq(domain, callback) { |
16 var req = new XMLHttpRequest(); | 16 var req = new XMLHttpRequest(); |
17 var url = domain + ":PORT/files/extensions/test_file.txt"; | 17 var url = domain + ":PORT/extensions/test_file.txt"; |
18 url = url.replace(/PORT/, config.testServer.port); | 18 url = url.replace(/PORT/, config.testServer.port); |
19 | 19 |
20 chrome.test.log("Requesting url: " + url); | 20 chrome.test.log("Requesting url: " + url); |
21 req.open("GET", url, true); | 21 req.open("GET", url, true); |
22 | 22 |
23 req.onload = function() { | 23 req.onload = function() { |
24 assertEq(200, req.status); | 24 assertEq(200, req.status); |
25 assertEq("Hello!", req.responseText); | 25 assertEq("Hello!", req.responseText); |
26 callback(true); | 26 callback(true); |
27 }; | 27 }; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 function noPromptForActivePermissions() { | 59 function noPromptForActivePermissions() { |
60 // We shouldn't prompt if the extension already has the permissions. | 60 // We shouldn't prompt if the extension already has the permissions. |
61 chrome.permissions.request( | 61 chrome.permissions.request( |
62 {permissions: ["management"]}, | 62 {permissions: ["management"]}, |
63 pass(function(granted) { | 63 pass(function(granted) { |
64 assertTrue(granted); | 64 assertTrue(granted); |
65 })); | 65 })); |
66 } | 66 } |
67 ]); | 67 ]); |
68 }); | 68 }); |
OLD | NEW |