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

Side by Side Diff: chrome/test/data/extensions/platform_apps/messaging/app2/background.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/data/extensions/platform_apps/messaging/app1/manifest.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 var otherId = 'ljhhihhmjomkjokmknellgbidphmahkh';
6
5 chrome.runtime.onConnectExternal.addListener(function(port) { 7 chrome.runtime.onConnectExternal.addListener(function(port) {
6 port.onMessage.addListener(function(msg) { 8 port.onMessage.addListener(function(msg) {
7 if (msg == 'ok_to_disconnect') { 9 if (msg == 'ok_to_disconnect') {
8 port.disconnect(); 10 port.disconnect();
9 } else { 11 } else {
10 port.postMessage(msg + '_reply'); 12 port.postMessage(msg + '_reply');
11 } 13 }
12 }); 14 });
13 }); 15 });
14 16
15 chrome.runtime.onMessageExternal.addListener(function(msg, sender, callback) { 17 chrome.runtime.onMessageExternal.addListener(function(msg, sender, callback) {
18 chrome.test.assertEq({id: otherId}, sender);
16 if (msg == 'hello') 19 if (msg == 'hello')
17 callback('hello_response'); 20 callback('hello_response');
18 else 21 else
19 callback(); 22 callback();
20 }); 23 });
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/platform_apps/messaging/app1/manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698