| 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.onDisconnect.addListener( | 90 port.onMessage.addListener(function(message) { |
| 91 chrome.test.callback(function() {}, "Native host has exited.")); | 91 port.onDisconnect.addListener(chrome.test.callback( |
| 92 function() {}, |
| 93 "Native host has exited.")); |
| 94 }); |
| 92 | 95 |
| 93 // Send first message that should stop the host. | 96 // Send first message that should stop the host. |
| 94 port.postMessage({ "stopHostTest": true }); | 97 port.postMessage({ "stopHostTest": true }); |
| 95 } | 98 } |
| 96 ]); | 99 ]); |
| 97 }); | 100 }); |
| OLD | NEW |