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

Side by Side Diff: chrome/test/data/extensions/platform_apps/messaging/app2/background.js

Issue 448473003: Attempt to fix flaky PlatformAppBrowserTest.Messaging. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added comment Created 6 years, 4 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/browser/apps/app_browsertest.cc ('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'; 5 var otherId = 'ljhhihhmjomkjokmknellgbidphmahkh';
6 6
7 chrome.test.sendMessage('Launched');
8
9 chrome.runtime.onConnectExternal.addListener(function(port) { 7 chrome.runtime.onConnectExternal.addListener(function(port) {
10 port.onMessage.addListener(function(msg) { 8 port.onMessage.addListener(function(msg) {
11 if (msg == 'ok_to_disconnect') { 9 if (msg == 'ok_to_disconnect') {
12 port.disconnect(); 10 port.disconnect();
13 } else { 11 } else {
14 port.postMessage(msg + '_reply'); 12 port.postMessage(msg + '_reply');
15 } 13 }
16 }); 14 });
17 }); 15 });
18 16
19 chrome.runtime.onMessageExternal.addListener(function(msg, sender, callback) { 17 chrome.runtime.onMessageExternal.addListener(function(msg, sender, callback) {
20 chrome.test.assertEq({id: otherId}, sender); 18 chrome.test.assertEq({id: otherId}, sender);
21 if (msg == 'hello') 19 if (msg == 'hello')
22 callback('hello_response'); 20 callback('hello_response');
23 else 21 else
24 callback(); 22 callback();
25 }); 23 });
24
25 // Must ensure that the listeners are active before sending the "Ready"
26 // message (which will cause app1 to be launched).
27 chrome.test.sendMessage('Ready');
OLDNEW
« no previous file with comments | « chrome/browser/apps/app_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698