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