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

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

Issue 1625993002: Mark opener extension port as opened after creation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 JSON.parse = function() { 5 JSON.parse = function() {
6 return "JSON.parse clobbered by content script."; 6 return "JSON.parse clobbered by content script.";
7 }; 7 };
8 8
9 JSON.stringify = function() { 9 JSON.stringify = function() {
10 return "JSON.stringify clobbered by content script."; 10 return "JSON.stringify clobbered by content script.";
(...skipping 22 matching lines...) Expand all
33 testSendMessageFromFrame(); 33 testSendMessageFromFrame();
34 } else if (msg.testSendMessageToFrame) { 34 } else if (msg.testSendMessageToFrame) {
35 port.postMessage('from_main'); 35 port.postMessage('from_main');
36 } else if (msg.testDisconnect) { 36 } else if (msg.testDisconnect) {
37 port.disconnect(); 37 port.disconnect();
38 } else if (msg.testConnectChildFrameAndNavigateSetup) { 38 } else if (msg.testConnectChildFrameAndNavigateSetup) {
39 chrome.runtime.onConnect.removeListener(onConnect); 39 chrome.runtime.onConnect.removeListener(onConnect);
40 chrome.test.assertFalse(chrome.runtime.onConnect.hasListeners()); 40 chrome.test.assertFalse(chrome.runtime.onConnect.hasListeners());
41 testConnectChildFrameAndNavigateSetup(); 41 testConnectChildFrameAndNavigateSetup();
42 } else if (msg.testDisconnectOnClose) { 42 } else if (msg.testDisconnectOnClose) {
43 window.location = "about:blank"; 43 chrome.runtime.connect().onMessage.addListener(function(msg) {
44 chrome.test.assertEq('unloadTabContent', msg);
45 window.location = 'about:blank';
46 });
44 } else if (msg.testPortName) { 47 } else if (msg.testPortName) {
45 port.postMessage({portName:port.name}); 48 port.postMessage({portName:port.name});
46 } else if (msg.testSendMessageFromTabError) { 49 } else if (msg.testSendMessageFromTabError) {
47 testSendMessageFromTabError(); 50 testSendMessageFromTabError();
48 } else if (msg.testConnectFromTabError) { 51 } else if (msg.testConnectFromTabError) {
49 testConnectFromTabError(); 52 testConnectFromTabError();
50 } 53 }
51 }); 54 });
52 }); 55 });
53 56
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 var success = (chrome.runtime.lastError ? true : false); 115 var success = (chrome.runtime.lastError ? true : false);
113 chrome.runtime.sendMessage({success: success}); 116 chrome.runtime.sendMessage({success: success});
114 }); 117 });
115 } 118 }
116 119
117 // For test sendMessage. 120 // For test sendMessage.
118 chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { 121 chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
119 chrome.test.assertEq({id: chrome.runtime.id}, sender); 122 chrome.test.assertEq({id: chrome.runtime.id}, sender);
120 sendResponse({success: (request.step2 == 1)}); 123 sendResponse({success: (request.step2 == 1)});
121 }); 124 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698