OLD | NEW |
(Empty) | |
| 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 // This tests whether we have permission to use individual functions, despite |
| 6 // not having asked for any permissions in the manifest. |
| 7 |
| 8 chrome.test.runTests([ |
| 9 |
| 10 // Test the tabs API. |
| 11 function tabs() { |
| 12 try { |
| 13 chrome.tabs.create({url: "404_is_enough.html"}, function(tab1) { |
| 14 chrome.tabs.update(tab1.id, {url: "404_again.html"}, function(tab2) { |
| 15 chrome.tabs.onRemoved.addListener(function(tabId, removeInfo) { |
| 16 chrome.test.assertEq(tab1.id, tabId); |
| 17 chrome.test.succeed(); |
| 18 }); |
| 19 chrome.tabs.remove(tab1.id); |
| 20 }); |
| 21 }); |
| 22 } catch (e) { |
| 23 chrome.test.fail(); |
| 24 } |
| 25 }, |
| 26 |
| 27 // Negative test for the tabs API. |
| 28 function tabsNegative() { |
| 29 try { |
| 30 var tab = chrome.tabs.getSelected(); |
| 31 chrome.test.fail(); |
| 32 } catch (e) { |
| 33 chrome.test.succeed(); |
| 34 } |
| 35 } |
| 36 |
| 37 ]); |
OLD | NEW |