Chromium Code Reviews| Index: chrome/test/data/extensions/api_test/permissions/optional_deny/background.html |
| diff --git a/chrome/test/data/extensions/api_test/permissions/optional_deny/background.html b/chrome/test/data/extensions/api_test/permissions/optional_deny/background.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..039e0b02531c6d6354244abdfe1cccd53590b4ee |
| --- /dev/null |
| +++ b/chrome/test/data/extensions/api_test/permissions/optional_deny/background.html |
| @@ -0,0 +1,32 @@ |
| +<script> |
| + |
| +var assertFalse = chrome.test.assertFalse; |
| +var assertTrue = chrome.test.assertTrue; |
| +var pass = chrome.test.callbackPass; |
| + |
| +var NO_TABS_PERMISSION = |
| + "You do not have permission to use 'windows.getAll'."; |
| + |
| +chrome.test.runTests([ |
| + function denyRequest() { |
| + chrome.permissions.request({apis: ['tabs']}, pass(function(granted) { |
| + // They were not granted, and there should be no error. |
| + assertFalse(granted); |
| + assertTrue(chrome.extension.lastError === undefined); |
| + |
| + // Make sure they weren't granted... |
| + chrome.permissions.contains({apis: ['tabs']}, pass(function(result) { |
| + assertFalse(result); |
| + })); |
| + |
| + try { |
| + chrome.windows.getAll({populate: true}, function() { |
| + assertTrue(false); |
|
Mihai Parparita -not on Chrome
2011/07/20 22:03:43
Ditto about using chrome.test.fail("Should not hav
jstritar
2011/07/22 19:21:55
Done.
|
| + }); |
| + } catch (e) { |
| + assertTrue(e.message.indexOf(NO_TABS_PERMISSION) == 0); |
| + } |
| + })); |
| + } |
| +]); |
| +</script> |