Chromium Code Reviews| Index: chrome/test/data/extensions/api_test/permissions/optional/background.js |
| diff --git a/chrome/test/data/extensions/api_test/permissions/optional/background.js b/chrome/test/data/extensions/api_test/permissions/optional/background.js |
| index 99af45053ba669c85347e61936e6515357ca4c5b..2507e7aacb684972e8482d6b2a9e15bb3ed38358 100644 |
| --- a/chrome/test/data/extensions/api_test/permissions/optional/background.js |
| +++ b/chrome/test/data/extensions/api_test/permissions/optional/background.js |
| @@ -12,9 +12,6 @@ var listenOnce = chrome.test.listenOnce; |
| var NOT_OPTIONAL_ERROR = |
| "Optional permissions must be listed in extension manifest."; |
| -var NO_BOOKMARKS_PERMISSION = |
| - "You do not have permission to use 'bookmarks.getTree'."; |
| - |
| var REQUIRED_ERROR = |
| "You cannot remove required permissions."; |
| @@ -130,13 +127,11 @@ chrome.test.getConfig(function(config) { |
| // chrome.bookmarks is a optional permission, so the API definition should |
| // exist but its use disallowed. |
| assertTrue(!!chrome.bookmarks); |
| - try { |
| - chrome.bookmarks.getTree(function() { |
| - chrome.test.fail("Should not have bookmarks API permission."); |
| - }); |
| - } catch (e) { |
| - assertTrue(e.message.indexOf(NO_BOOKMARKS_PERMISSION) == 0); |
| - } |
| + assertTrue(chrome.runtime.lastError === undefined); |
| + chrome.bookmarks.getTree(function() { |
| + assertFalse(chrome.runtime.lastError === undefined); |
|
not at google - send to devlin
2013/05/30 16:38:52
What fails? You should use chrome.test.callbackFai
cduvall
2013/06/12 01:22:19
Fixed in optional permission reload.
|
| + }); |
| + |
| listenOnce(chrome.permissions.onAdded, |
| function(permissions) { |
| assertTrue(permissions.permissions.length == 1); |
| @@ -205,13 +200,11 @@ chrome.test.getConfig(function(config) { |
| chrome.permissions.getAll(pass(function(permissions) { |
| assertTrue(checkPermSetsEq(initialPermissions, permissions)); |
| })); |
| - try { |
| - chrome.bookmarks.getTree(function() { |
| - chrome.test.fail("Should not have bookmarks API permission."); |
| - }); |
| - } catch (e) { |
| - assertTrue(e.message.indexOf(NO_BOOKMARKS_PERMISSION) == 0); |
| - } |
| + |
| + assertTrue(chrome.runtime.lastError === undefined); |
| + chrome.bookmarks.getTree(function() { |
| + assertFalse(chrome.runtime.lastError === undefined); |
| + }); |
| })); |
| }, |
| @@ -305,13 +298,10 @@ chrome.test.getConfig(function(config) { |
| }); |
| listenOnce(chrome.permissions.onRemoved, |
| function(permissions) { |
| - try { |
| - chrome.bookmarks.getTree(function() { |
| - chrome.test.fail("Should not have bookmakrs API permission."); |
| - }); |
| - } catch (e) { |
| - assertTrue(e.message.indexOf(NO_BOOKMARKS_PERMISSION) == 0); |
| - } |
| + assertTrue(chrome.runtime.lastError === undefined); |
| + chrome.bookmarks.getTree(function() { |
| + assertFalse(chrome.runtime.lastError === undefined); |
| + }); |
| }); |
| chrome.permissions.request( |