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 |
index 92f09d8d833145e35e0d21d5a4e8653416d25278..d514785f1fcca2de150fe01cd69f1e2daaa62f77 100644 |
--- a/chrome/test/data/extensions/api_test/permissions/optional_deny/background.html |
+++ b/chrome/test/data/extensions/api_test/permissions/optional_deny/background.html |
@@ -7,30 +7,58 @@ var pass = chrome.test.callbackPass; |
var NO_TABS_PERMISSION = |
"You do not have permission to use 'windows.getAll'."; |
-chrome.test.runTests([ |
- function denyRequest() { |
- chrome.experimental.permissions.request( |
- {permissions: ['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.experimental.permissions.contains( |
- {permissions: ['tabs']}, |
- pass(function(result) { |
- assertFalse(result); |
- })); |
- |
- 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.test.getConfig(function(config) { |
+ |
+ function doReq(domain, callback) { |
+ var req = new XMLHttpRequest(); |
+ var url = domain + ":PORT/files/extensions/test_file.txt"; |
+ url = url.replace(/PORT/, config.testServer.port); |
+ |
+ chrome.test.log("Requesting url: " + url); |
+ req.open("GET", url, true); |
+ |
+ req.onload = function() { |
+ assertEq(200, req.status); |
+ assertEq("Hello!", req.responseText); |
+ callback(true); |
+ }; |
+ |
+ req.onerror = function() { |
+ chrome.test.log("status: " + req.status); |
+ chrome.test.log("text: " + req.responseText); |
+ callback(false); |
+ }; |
+ |
+ req.send(null); |
} |
-]); |
+ |
+ chrome.test.runTests([ |
+ function denyRequest() { |
+ chrome.experimental.permissions.request( |
+ {permissions: ['tabs'], origins: ['http://*.c.com/*']}, |
+ 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.experimental.permissions.contains( |
+ {permissions: ['tabs'], origins:['http://*.c.com/*']}, |
+ pass(function(result) { assertFalse(result); })); |
+ |
+ 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); |
+ } |
+ |
+ doReq('http://b.c.com/', pass(function(result) { |
+ assertFalse(result); |
+ })); |
+ })); |
+ } |
+ ]); |
+}); |
</script> |