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 pass = chrome.test.callbackPass; | 7 var pass = chrome.test.callbackPass; |
8 | 8 |
9 var NO_BOOKMARKS_PERMISSION = | 9 var NO_BOOKMARKS_PERMISSION = |
10 "You do not have permission to use 'bookmarks.getTree'."; | 10 "You do not have permission to use 'bookmarks.getTree'."; |
(...skipping 23 matching lines...) Expand all Loading... |
34 req.send(null); | 34 req.send(null); |
35 } | 35 } |
36 | 36 |
37 chrome.test.runTests([ | 37 chrome.test.runTests([ |
38 function denyRequest() { | 38 function denyRequest() { |
39 chrome.permissions.request( | 39 chrome.permissions.request( |
40 {permissions: ['bookmarks'], origins: ['http://*.c.com/*']}, | 40 {permissions: ['bookmarks'], origins: ['http://*.c.com/*']}, |
41 pass(function(granted) { | 41 pass(function(granted) { |
42 // They were not granted, and there should be no error. | 42 // They were not granted, and there should be no error. |
43 assertFalse(granted); | 43 assertFalse(granted); |
44 assertTrue(chrome.extension.lastError === undefined); | 44 assertTrue(chrome.runtime.lastError === undefined); |
45 | 45 |
46 // Make sure they weren't granted... | 46 // Make sure they weren't granted... |
47 chrome.permissions.contains( | 47 chrome.permissions.contains( |
48 {permissions: ['bookmarks'], origins:['http://*.c.com/*']}, | 48 {permissions: ['bookmarks'], origins:['http://*.c.com/*']}, |
49 pass(function(result) { assertFalse(result); })); | 49 pass(function(result) { assertFalse(result); })); |
50 | 50 |
51 try { | 51 try { |
52 chrome.bookmarks.getTree(function() { | 52 chrome.bookmarks.getTree(function() { |
53 chrome.test.fail("Should not have bookmarks API permission."); | 53 chrome.test.fail("Should not have bookmarks API permission."); |
54 }); | 54 }); |
(...skipping 10 matching lines...) Expand all Loading... |
65 function noPromptForActivePermissions() { | 65 function noPromptForActivePermissions() { |
66 // We shouldn't prompt if the extension already has the permissions. | 66 // We shouldn't prompt if the extension already has the permissions. |
67 chrome.permissions.request( | 67 chrome.permissions.request( |
68 {permissions: ["management"]}, | 68 {permissions: ["management"]}, |
69 pass(function(granted) { | 69 pass(function(granted) { |
70 assertTrue(granted); | 70 assertTrue(granted); |
71 })); | 71 })); |
72 } | 72 } |
73 ]); | 73 ]); |
74 }); | 74 }); |
OLD | NEW |