Index: chrome/test/data/extensions/api_test/webrequest_extensions/extension/background.js |
diff --git a/chrome/test/data/extensions/api_test/webrequest_extensions/extension/background.js b/chrome/test/data/extensions/api_test/webrequest_extensions/extension/background.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e52ff7bafb9990ce1e0f0c9b0d151133c7071b93 |
--- /dev/null |
+++ b/chrome/test/data/extensions/api_test/webrequest_extensions/extension/background.js |
@@ -0,0 +1,30 @@ |
+// Copyright (c) 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+chrome.test.getConfig(function(config) { |
+ var baseUrl = 'http://example.com:' + config.testServer.port; |
+ var pageUrl = baseUrl + '/extensions/test_file.html?open-to-finish-test'; |
+ |
+ var x = new XMLHttpRequest(); |
+ x.open('GET', baseUrl + '/extensions/test_file.txt?extension'); |
+ x.onloadend = function() { |
+ // Just a sanity check to ensure that the server is running. |
+ // The test does not change the response. |
+ chrome.test.assertEq('Hello!', x.responseText); |
+ |
+ chrome.webNavigation.onCompleted.addListener(function(details) { |
+ // After creating the tab, the onBeforeRequest event in the |
+ // eavesdropping extension should be triggered. |
+ chrome.test.sendMessage('extension_done'); |
not at google - send to devlin
2015/08/04 20:27:02
good practice to remove listener after this.
robwu
2015/08/04 21:57:24
I've removed the tab-load detection from the page,
|
+ }, { |
+ url: [{ |
+ urlEquals: pageUrl |
+ }] |
+ }); |
+ chrome.tabs.create({ |
+ url: pageUrl |
+ }); |
+ }; |
+ x.send(); |
+}); |