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

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

Issue 1413543005: Use FrameTreeNode ID as frameId in extension APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/:/ / Created 4 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/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

Powered by Google App Engine
This is Rietveld 408576698