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

Side by Side Diff: chrome/test/data/extensions/api_test/socket/api/background.js

Issue 12684008: Multicast socket API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix code style Created 7 years, 8 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 // net/tools/testserver/testserver.py is picky about the format of what it 5 // net/tools/testserver/testserver.py is picky about the format of what it
6 // calls its "echo" messages. One might go so far as to mutter to oneself that 6 // calls its "echo" messages. One might go so far as to mutter to oneself that
7 // it isn't an echo server at all. 7 // it isn't an echo server at all.
8 // 8 //
9 // The response is based on the request but obfuscated using a random key. 9 // The response is based on the request but obfuscated using a random key.
10 const request = "0100000005320000005hello"; 10 const request = "0100000005320000005hello";
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 function onServerSocketCreate(socketInfo) { 229 function onServerSocketCreate(socketInfo) {
230 socketId = socketInfo.socketId; 230 socketId = socketInfo.socketId;
231 socket.listen(socketId, address, port, onListen); 231 socket.listen(socketId, address, port, onListen);
232 } 232 }
233 233
234 socket.create('tcp', {}, onServerSocketCreate); 234 socket.create('tcp', {}, onServerSocketCreate);
235 }; 235 };
236 236
237 var onMessageReply = function(message) { 237 var onMessageReply = function(message) {
238 var parts = message.split(":"); 238 var parts = message.split(":");
239 test_type = parts[0]; 239 var test_type = parts[0];
240 address = parts[1]; 240 address = parts[1];
241 port = parseInt(parts[2]); 241 port = parseInt(parts[2]);
242 console.log("Running tests, protocol " + protocol + ", echo server " + 242 console.log("Running tests, protocol " + protocol + ", echo server " +
243 address + ":" + port); 243 address + ":" + port);
244 if (test_type == 'tcp_server') { 244 if (test_type == 'tcp_server') {
245 chrome.test.runTests([ testSocketListening ]); 245 chrome.test.runTests([ testSocketListening ]);
246 } else if (test_type == 'multicast') {
247 console.log("Running multicast tests");
248 chrome.test.runTests([ testMulticast ]);
246 } else { 249 } else {
247 protocol = test_type; 250 protocol = test_type;
248 chrome.test.runTests([ testSocketCreation, testSending ]); 251 chrome.test.runTests([ testSocketCreation, testSending ]);
249 } 252 }
250 }; 253 };
251 254
252 // Find out which protocol we're supposed to test, and which echo server we 255 // Find out which protocol we're supposed to test, and which echo server we
253 // should be using, then kick off the tests. 256 // should be using, then kick off the tests.
254 chrome.test.sendMessage("info_please", onMessageReply); 257 chrome.test.sendMessage("info_please", onMessageReply);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698