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

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

Issue 11745015: Update references to the extension messaging APIs to point to the "runtime" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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 83ce26be872ffc6cdc257cbe596e1aa431611aea..7d141f6642e752e991e324e17b67d72fdaee53cb 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.extension.onConnect.addListener(function(port) {
+chrome.runtime.onConnect.addListener(function(port) {
console.log('connected');
port.onMessage.addListener(function(msg) {
console.log('got ' + msg);
@@ -46,7 +46,7 @@ chrome.extension.onConnect.addListener(function(port) {
// Tests that postMessage to the extension and its response works.
function testPostMessageFromTab(origPort) {
var portName = "peter";
- var port = chrome.extension.connect({name: portName});
+ var port = chrome.runtime.connect({name: portName});
port.postMessage({testPostMessageFromTab: true});
port.onMessage.addListener(function(msg) {
origPort.postMessage({success: (msg.success && (msg.portName == portName))});
@@ -57,10 +57,10 @@ function testPostMessageFromTab(origPort) {
// For test onMessage.
function testSendMessageFromTab() {
- chrome.extension.sendMessage({step: 1}, function(response) {
+ chrome.runtime.sendMessage({step: 1}, function(response) {
if (response.nextStep) {
console.log('testSendMessageFromTab sent');
- chrome.extension.sendMessage({step: 2});
+ chrome.runtime.sendMessage({step: 2});
}
});
}
@@ -68,22 +68,22 @@ function testSendMessageFromTab() {
// Tests sendMessage to an invalid extension.
function testSendMessageFromTabError() {
// try sending a request to a bad extension id
- chrome.extension.sendMessage("bad-extension-id", {m: 1}, function(response) {
- var success = (response === undefined && chrome.extension.lastError);
- chrome.extension.sendMessage({success: success});
+ chrome.runtime.sendMessage("bad-extension-id", {m: 1}, function(response) {
+ var success = (response === undefined && chrome.runtime.lastError);
+ chrome.runtime.sendMessage({success: success});
});
}
// Tests connecting to an invalid extension.
function testConnectFromTabError() {
- var port = chrome.extension.connect("bad-extension-id");
+ var port = chrome.runtime.connect("bad-extension-id");
port.onDisconnect.addListener(function() {
- var success = (chrome.extension.lastError ? true : false);
- chrome.extension.sendMessage({success: success});
+ var success = (chrome.runtime.lastError ? true : false);
+ chrome.runtime.sendMessage({success: success});
});
}
// For test sendMessage.
-chrome.extension.onMessage.addListener(function(request, sender, sendResponse) {
+chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
sendResponse({success: (request.step2 == 1)});
});

Powered by Google App Engine
This is Rietveld 408576698