Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3239)

Unified Diff: chrome/test/data/extensions/api_test/permissions/optional/background.html

Issue 7695003: Fix issue with permissions extension API event listeners. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/extension_permissions_api.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/permissions/optional/background.html
diff --git a/chrome/test/data/extensions/api_test/permissions/optional/background.html b/chrome/test/data/extensions/api_test/permissions/optional/background.html
index 8593ab52ae290b42889a0b3e0c74834577cf3685..825b30629a603e007217934b8661f9b2ae15d8f6 100644
--- a/chrome/test/data/extensions/api_test/permissions/optional/background.html
+++ b/chrome/test/data/extensions/api_test/permissions/optional/background.html
@@ -276,6 +276,36 @@ chrome.test.getConfig(function(config) {
pass(function(result) { assertFalse(result); }));
doReq('http://c.com', pass(function(result) { assertFalse(result); }));
}));
+ },
+
+ // Tests that the changed permissions have taken effect from inside the
+ // onAdded and onRemoved event listeners.
+ function eventListenerPermissions() {
+ listenOnce(chrome.experimental.permissions.onAdded,
+ function(permissions) {
+ chrome.windows.getAll({populate: true}, pass(function() {
+ assertTrue(true);
+ }));
+ });
+ listenOnce(chrome.experimental.permissions.onRemoved,
+ function(permissions) {
+ try {
+ chrome.windows.getAll({populate: true}, function() {
+ chrome.test.fail("Should not have tabs API permission.");
+ });
+ } catch (e) {
+ assertTrue(e.message.indexOf(NO_TABS_PERMISSION) == 0);
+ }
+ });
+
+ chrome.experimental.permissions.request(
+ {permissions: ['tabs']}, pass(function(granted) {
+ assertTrue(granted);
+ chrome.experimental.permissions.remove(
+ {permissions: ['tabs']}, pass(function() {
+ assertTrue(true);
+ }));
+ }));
}
]);
« no previous file with comments | « chrome/browser/extensions/extension_permissions_api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698