OLD | NEW |
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 chrome.test.succeed(); | 80 chrome.test.succeed(); |
81 else | 81 else |
82 port.postMessage(messagesToSend[currentMessage]); | 82 port.postMessage(messagesToSend[currentMessage]); |
83 }); | 83 }); |
84 }, | 84 }, |
85 | 85 |
86 // Verify that the case when host stops itself is handled properly. | 86 // Verify that the case when host stops itself is handled properly. |
87 function stopHost() { | 87 function stopHost() { |
88 port = chrome.extension.connectNative(appName); | 88 port = chrome.extension.connectNative(appName); |
89 | 89 |
90 port.onMessage.addListener(function(message) { | 90 port.onDisconnect.addListener( |
91 port.onDisconnect.addListener(chrome.test.callback( | 91 chrome.test.callback(function() {}, "Native host has exited.")); |
92 function() {}, | |
93 "Native host has exited.")); | |
94 }); | |
95 | 92 |
96 // Send first message that should stop the host. | 93 // Send first message that should stop the host. |
97 port.postMessage({ "stopHostTest": true }); | 94 port.postMessage({ "stopHostTest": true }); |
98 } | 95 } |
99 ]); | 96 ]); |
100 }); | 97 }); |
OLD | NEW |