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

Unified Diff: chrome/test/data/extensions/api_test/messaging/connect/test.js

Issue 14301016: Fix a couple of bugs relating to sending Tab info with chrome.runtime.connect and (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add key to app1/manifest.json Created 7 years, 8 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/messaging/connect/test.js
diff --git a/chrome/test/data/extensions/api_test/messaging/connect/test.js b/chrome/test/data/extensions/api_test/messaging/connect/test.js
index 51d3baf4cc9abe1affa3555dc878192dc7b49902..c79f489624b0d684ed06479cabb27fd67cbb5b55 100644
--- a/chrome/test/data/extensions/api_test/messaging/connect/test.js
+++ b/chrome/test/data/extensions/api_test/messaging/connect/test.js
@@ -28,9 +28,9 @@ chrome.test.getConfig(function(config) {
chrome.tabs.create({
url: "http://localhost:PORT/files/extensions/test_file.html"
.replace(/PORT/, config.testServer.port)
- }, function(tab) {
- chrome.tabs.onUpdated.addListener(function listener(tabid, info) {
- if (tab.id == tabid && info.status == 'complete') {
+ }, function(newTab) {
+ chrome.tabs.onUpdated.addListener(function listener(_, info, tab) {
+ if (tab.id == newTab.id && info.status == 'complete') {
chrome.test.log("Created tab: " + tab.url);
chrome.tabs.onUpdated.removeListener(listener);
testTab = tab;
@@ -65,9 +65,11 @@ chrome.test.getConfig(function(config) {
// Tests that postMessage from the tab and its response works.
function postMessageFromTab() {
chrome.runtime.onConnect.addListener(function(port) {
- chrome.test.assertTrue(Boolean(port.sender.tab.url));
- chrome.test.assertTrue(Boolean(port.sender.tab.title));
- chrome.test.assertTrue(Boolean(port.sender.tab.id));
+ chrome.test.assertEq({
+ tab: testTab,
+ url: testTab.url,
+ id: chrome.runtime.id
+ }, port.sender);
port.onMessage.addListener(function(msg) {
chrome.test.assertTrue(msg.testPostMessageFromTab);
port.postMessage({success: true, portName: port.name});
@@ -89,8 +91,11 @@ chrome.test.getConfig(function(config) {
var doneListening = chrome.test.listenForever(
chrome.runtime.onMessage,
function(request, sender, sendResponse) {
- chrome.test.assertTrue("url" in sender.tab, "no tab available.");
- chrome.test.assertEq(sender.id, location.host);
+ chrome.test.assertEq({
+ tab: testTab,
+ url: testTab.url,
+ id: chrome.runtime.id
+ }, sender);
if (request.step == 1) {
// Step 1: Page should send another request for step 2.
chrome.test.log("sendMessageFromTab: got step 1");

Powered by Google App Engine
This is Rietveld 408576698