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

Unified 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: Add License info to multicast.js 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/socket/api/background.js
diff --git a/chrome/test/data/extensions/api_test/socket/api/background.js b/chrome/test/data/extensions/api_test/socket/api/background.js
index 7f78b564ab9c7d340a3a2102b267e4d5a30aeed5..5b3b425806a4ebd05b7c0ca2559868cfbb17e2c5 100644
--- a/chrome/test/data/extensions/api_test/socket/api/background.js
+++ b/chrome/test/data/extensions/api_test/socket/api/background.js
@@ -42,26 +42,23 @@ function arrayBuffer2String(buf, callback) {
}
var testSocketCreation = function() {
- function onGetInfo(info) {
- chrome.test.assertEq(info.socketType, protocol);
- chrome.test.assertFalse(info.connected);
+ function onCreate(socketInfo) {
+ function onGetInfo(info) {
+ chrome.test.assertEq(info.socketType, protocol);
+ chrome.test.assertFalse(info.connected);
- if (info.peerAddress || info.peerPort) {
- chrome.test.fail('Unconnected socket should not have peer');
- }
- if (info.localAddress || info.localPort) {
- chrome.test.fail('Unconnected socket should not have local binding');
- }
+ if (info.peerAddress || info.peerPort) {
+ chrome.test.fail('Unconnected socket should not have peer');
+ }
+ if (info.localAddress || info.localPort) {
+ chrome.test.fail('Unconnected socket should not have local binding');
+ }
- // TODO(miket): this doesn't work yet. It's possible this will become
- // automatic, but either way we can't forget to clean up.
- //
- //socket.destroy(socketInfo.socketId);
+ socket.destroy(socketInfo.socketId);
- chrome.test.succeed();
- }
+ chrome.test.succeed();
+ }
- function onCreate(socketInfo) {
chrome.test.assertTrue(socketInfo.socketId > 0);
// Obtaining socket information before a connect() call should be safe, but
@@ -236,13 +233,16 @@ var testSocketListening = function() {
var onMessageReply = function(message) {
var parts = message.split(":");
- test_type = parts[0];
+ var test_type = parts[0];
address = parts[1];
port = parseInt(parts[2]);
console.log("Running tests, protocol " + protocol + ", echo server " +
address + ":" + port);
if (test_type == 'tcp_server') {
chrome.test.runTests([ testSocketListening ]);
+ } else if (test_type == 'multicast') {
+ console.log("Running multicast tests");
+ chrome.test.runTests([ testMulticast ]);
} else {
protocol = test_type;
chrome.test.runTests([ testSocketCreation, testSending ]);

Powered by Google App Engine
This is Rietveld 408576698