| Index: chrome/test/data/extensions/api_test/messaging/connect/page.js
|
| diff --git a/chrome/test/data/extensions/api_test/messaging/connect/page.js b/chrome/test/data/extensions/api_test/messaging/connect/page.js
|
| index b8a88a365c17f269cbb9e81fa3513177296c0d35..bf122e7a9157e6f72809b5b348d3f06060e3911a 100644
|
| --- a/chrome/test/data/extensions/api_test/messaging/connect/page.js
|
| +++ b/chrome/test/data/extensions/api_test/messaging/connect/page.js
|
| @@ -19,7 +19,7 @@ Object.prototype.toJSON = function() {
|
| };
|
|
|
| // For complex connect tests.
|
| -chrome.runtime.onConnect.addListener(function(port) {
|
| +chrome.runtime.onConnect.addListener(function onConnect(port) {
|
| console.log('connected');
|
| port.onMessage.addListener(function(msg) {
|
| console.log('got ' + msg);
|
| @@ -35,6 +35,10 @@ chrome.runtime.onConnect.addListener(function(port) {
|
| port.postMessage('from_main');
|
| } else if (msg.testDisconnect) {
|
| port.disconnect();
|
| + } else if (msg.testConnectChildFrameAndNavigateSetup) {
|
| + chrome.runtime.onConnect.removeListener(onConnect);
|
| + chrome.test.assertFalse(chrome.runtime.onConnect.hasListeners());
|
| + testConnectChildFrameAndNavigateSetup();
|
| } else if (msg.testDisconnectOnClose) {
|
| window.location = "about:blank";
|
| } else if (msg.testPortName) {
|
| @@ -81,6 +85,17 @@ function testSendMessageFromFrame() {
|
| }
|
| }
|
|
|
| +function testConnectChildFrameAndNavigateSetup() {
|
| + var frames = document.querySelectorAll('iframe');
|
| + for (var i = 0; i < frames.length; ++i) {
|
| + frames[i].remove();
|
| + }
|
| + var f = document.createElement('iframe');
|
| + f.src = '?testConnectChildFrameAndNavigateSetup';
|
| + document.body.appendChild(f);
|
| + // Test will continue in frame.js
|
| +}
|
| +
|
| // Tests sendMessage to an invalid extension.
|
| function testSendMessageFromTabError() {
|
| // try sending a request to a bad extension id
|
|
|