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

Unified Diff: chrome/test/data/extensions/api_test/connect/test.html

Issue 341025: Change the extension.onRequest even to include the sender info. (Closed)
Patch Set: fix args Created 11 years, 2 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
« no previous file with comments | « chrome/test/data/extensions/api_test/connect/page.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/connect/test.html
diff --git a/chrome/test/data/extensions/api_test/connect/test.html b/chrome/test/data/extensions/api_test/connect/test.html
index 31868b431ac9844a12256234d2144dd5d2f7b03d..b108a8d3330f91ebb4cb8a51ee87cf10f088d7bb 100644
--- a/chrome/test/data/extensions/api_test/connect/test.html
+++ b/chrome/test/data/extensions/api_test/connect/test.html
@@ -2,22 +2,25 @@
chrome.test.runTests([
// Tests receiving a request from a content script and responding.
function onRequest() {
- chrome.extension.onRequest.addListener(function(request, sendResponse) {
- if (request.step == 1) {
- // Step 1: Page should send another request for step 2.
- sendResponse({nextStep: true});
- } else {
- // Step 2.
- chrome.test.assertEq(request.step, 2);
- sendResponse({});
- chrome.test.succeed();
- }
- });
+ chrome.extension.onRequest.addListener(
+ function(request, sender, sendResponse) {
+ chrome.test.assertTrue("url" in sender.tab, "no tab available.");
+ chrome.test.assertEq(sender.id, location.host);
+ if (request.step == 1) {
+ // Step 1: Page should send another request for step 2.
+ sendResponse({nextStep: true});
+ } else {
+ // Step 2.
+ chrome.test.assertEq(request.step, 2);
+ sendResponse({});
+ chrome.test.succeed();
+ }
+ });
},
// Tests sending a request to a tab and receiving a response.
function sendRequest() {
chrome.tabs.getSelected(null, function(tab) {
- chrome.test.log('Selected tab: ' + tab.url);
+ chrome.test.log("Selected tab: " + tab.url);
chrome.tabs.sendRequest(tab.id, {step2: 1}, function(response) {
chrome.test.assertTrue(response.success);
chrome.test.succeed();
« no previous file with comments | « chrome/test/data/extensions/api_test/connect/page.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698