Chromium Code Reviews| Index: chrome/test/data/extensions/api_test/active_tab/background.js |
| diff --git a/chrome/test/data/extensions/api_test/active_tab/background.js b/chrome/test/data/extensions/api_test/active_tab/background.js |
| index cdafdc622bc5ba2015e813b6b9331c3c8b37cc0c..00b95ae6a5f88f5aec4c1ed08a0df8f6a4d741ab 100644 |
| --- a/chrome/test/data/extensions/api_test/active_tab/background.js |
| +++ b/chrome/test/data/extensions/api_test/active_tab/background.js |
| @@ -10,8 +10,26 @@ var callbackPass = chrome.test.callbackPass; |
| var RoleType = chrome.automation.RoleType; |
| +var url = null; |
| + |
| +function canXhr() { |
| + assertFalse(url == null); |
| + var xhr = new XMLHttpRequest(); |
| + xhr.open('GET', url, false); |
| + var success = true; |
| + try { |
| + xhr.send(); |
| + } catch(e) { |
| + success = false; |
| + } |
| + return success; |
| +} |
| + |
| chrome.browserAction.onClicked.addListener(function() { |
| chrome.tabs.executeScript({ code: 'true' }, callbackPass()); |
| + |
| + assertTrue(canXhr(url)); |
|
not at google - send to devlin
2015/02/03 19:29:12
canXhr() doesn't take a URL, but it seems like thi
Devlin
2015/02/04 22:26:02
It was my circumvention around doing an async tabs
|
| + |
| chrome.automation.getTree(callbackPass(function(rootNode) { |
| assertFalse(rootNode == undefined); |
| assertEq(RoleType.rootWebArea, rootNode.role); |
| @@ -27,4 +45,7 @@ chrome.webNavigation.onCompleted.addListener(function(details) { |
| chrome.automation.getTree(callbackFail( |
| 'Cannot request automation tree on url "' + details.url + |
| '". Extension manifest must request permission to access this host.')); |
| + |
| + url = details.url; |
| + assertFalse(canXhr()); |
| }); |