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

Unified Diff: chrome/test/data/extensions/api_test/active_tab/background.js

Issue 890083002: [Extensions] Propagate activeTab hosts to extension background pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
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());
});

Powered by Google App Engine
This is Rietveld 408576698