| 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 = navigator.platform.match(/win/i) ? 'echo.bat' : 'echo.py'; |
| 6 | 6 |
| 7 chrome.test.getConfig(function(config) { | 7 chrome.test.getConfig(function(config) { |
| 8 chrome.test.runTests([ | 8 chrome.test.runTests([ |
| 9 | 9 |
| 10 function sendMessageWithCallback() { | 10 function sendMessageWithCallback() { |
| 11 var message = {"text": "Hi there!", "number": 3}; | 11 var message = {"text": "Hi there!", "number": 3}; |
| 12 chrome.runtime.sendNativeMessage( | 12 chrome.runtime.sendNativeMessage( |
| 13 appName, message, | 13 appName, message, |
| 14 chrome.test.callbackPass(function(nativeResponse) { | 14 chrome.test.callbackPass(function(nativeResponse) { |
| 15 var expectedResponse = {"id": 1, "echo": message}; | 15 var expectedResponse = {"id": 1, "echo": message}; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 41 currentMessage++; | 41 currentMessage++; |
| 42 | 42 |
| 43 if (currentMessage == expectedResponses.length) | 43 if (currentMessage == expectedResponses.length) |
| 44 chrome.test.notifyPass(); | 44 chrome.test.notifyPass(); |
| 45 else | 45 else |
| 46 port.postMessage(messagesToSend[currentMessage]); | 46 port.postMessage(messagesToSend[currentMessage]); |
| 47 }); | 47 }); |
| 48 } | 48 } |
| 49 ]); | 49 ]); |
| 50 }); | 50 }); |
| OLD | NEW |