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

Side by Side Diff: chrome/test/data/extensions/api_test/native_messaging/test.js

Issue 24409004: Disconnect native messaging port on read pipe EOF. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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
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 appName = 'com.google.chrome.test.echo'; 5 var appName = 'com.google.chrome.test.echo';
6 6
7 chrome.test.getConfig(function(config) { 7 chrome.test.getConfig(function(config) {
8 chrome.test.runTests([ 8 chrome.test.runTests([
9 function invalidHostName() { 9 function invalidHostName() {
10 var message = {"text": "Hello!"}; 10 var message = {"text": "Hello!"};
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 }); 69 });
70 }, 70 },
71 71
72 // Verify that the case when host stops itself is handled properly. 72 // Verify that the case when host stops itself is handled properly.
73 function stopHost() { 73 function stopHost() {
74 port = chrome.extension.connectNative(appName); 74 port = chrome.extension.connectNative(appName);
75 75
76 port.onMessage.addListener(function(message) { 76 port.onMessage.addListener(function(message) {
77 port.onDisconnect.addListener(chrome.test.callback( 77 port.onDisconnect.addListener(chrome.test.callback(
78 function() {}, 78 function() {},
79 "Error when communicating with the native messaging host.")); 79 "Native host has exited."));
80 // Sending second message here should fail because the host has
81 // already stopped.
82 port.postMessage({ "secondMessage" : "foo" });
83 }); 80 });
84 81
85 // Send first message that should stop the host. 82 // Send first message that should stop the host.
86 port.postMessage({ "stopHostTest": true }); 83 port.postMessage({ "stopHostTest": true });
87 } 84 }
88 ]); 85 ]);
89 }); 86 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698