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

Unified Diff: chrome/test/data/extensions/api_test/native_messaging/test.js

Issue 10918255: The Windows portion of Native Messagaing (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/native_messaging/test.js
diff --git a/chrome/test/data/extensions/api_test/native_messaging/test.js b/chrome/test/data/extensions/api_test/native_messaging/test.js
index cb58585ff73cea79ccb99eb8adb7341e6a946b75..62b464b5fac61b092715bf0d7a8bba615766ee47 100644
--- a/chrome/test/data/extensions/api_test/native_messaging/test.js
+++ b/chrome/test/data/extensions/api_test/native_messaging/test.js
@@ -2,26 +2,28 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+var appName = navigator.platform.match(/win/i) ? 'echo.bat' : 'echo.py';
+
chrome.test.getConfig(function(config) {
chrome.test.runTests([
+ // The goal of this test is just not to crash.
+ function sendMessageWithoutCallback() {
+ var message = {"text": "Hi there!", "number": 3};
+ chrome.extension.sendNativeMessage(appName, message);
+ chrome.test.succeed(); // Mission Complete
+ },
+
function sendMessageWithCallback() {
var message = {"text": "Hi there!", "number": 3};
chrome.extension.sendNativeMessage(
- 'echo.py', message,
+ appName, message,
chrome.test.callbackPass(function(nativeResponse) {
var expectedResponse = {"id": 1, "echo": message};
chrome.test.assertEq(expectedResponse, nativeResponse);
}));
},
- // The goal of this test, is just not to crash.
- function sendMessageWithoutCallback() {
- var message = {"text": "Hi there!", "number": 3};
- chrome.extension.sendNativeMessage('echo.py', message);
- chrome.test.succeed(); // Mission Complete
- },
-
function connect() {
var messagesToSend = [{"text": "foo"},
{"text": "bar", "funCount": 9001},
@@ -31,7 +33,7 @@ chrome.test.getConfig(function(config) {
{"id": 3, "echo": messagesToSend[2]}];
var currentMessage = 0;
- port = chrome.extension.connectNative('echo.py',
+ port = chrome.extension.connectNative(appName,
messagesToSend[currentMessage]);
port.onMessage.addListener(function(message) {
chrome.test.assertEq(expectedResponses[currentMessage], message);

Powered by Google App Engine
This is Rietveld 408576698