| 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 // 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 chrome.test.assertFalse(info.connected); | 48 chrome.test.assertFalse(info.connected); |
| 49 | 49 |
| 50 if (info.peerAddress || info.peerPort) { | 50 if (info.peerAddress || info.peerPort) { |
| 51 chrome.test.fail('Unconnected socket should not have peer'); | 51 chrome.test.fail('Unconnected socket should not have peer'); |
| 52 } | 52 } |
| 53 if (info.localAddress || info.localPort) { | 53 if (info.localAddress || info.localPort) { |
| 54 chrome.test.fail('Unconnected socket should not have local binding'); | 54 chrome.test.fail('Unconnected socket should not have local binding'); |
| 55 } | 55 } |
| 56 | 56 |
| 57 socket.destroy(socketInfo.socketId); | 57 socket.destroy(socketInfo.socketId); |
| 58 | 58 socket.getInfo(socketInfo.socketId, function(info) { |
| 59 chrome.test.succeed(); | 59 chrome.test.assertEq(undefined, info); |
| 60 chrome.test.succeed(); |
| 61 }); |
| 60 } | 62 } |
| 61 | 63 |
| 62 chrome.test.assertTrue(socketInfo.socketId > 0); | 64 chrome.test.assertTrue(socketInfo.socketId > 0); |
| 63 | 65 |
| 64 // Obtaining socket information before a connect() call should be safe, but | 66 // Obtaining socket information before a connect() call should be safe, but |
| 65 // return empty values. | 67 // return empty values. |
| 66 socket.getInfo(socketInfo.socketId, onGetInfo); | 68 socket.getInfo(socketInfo.socketId, onGetInfo); |
| 67 } | 69 } |
| 68 | 70 |
| 69 socket.create(protocol, {}, onCreate); | 71 socket.create(protocol, {}, onCreate); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 chrome.test.runTests([ testMulticast ]); | 247 chrome.test.runTests([ testMulticast ]); |
| 246 } else { | 248 } else { |
| 247 protocol = test_type; | 249 protocol = test_type; |
| 248 chrome.test.runTests([ testSocketCreation, testSending ]); | 250 chrome.test.runTests([ testSocketCreation, testSending ]); |
| 249 } | 251 } |
| 250 }; | 252 }; |
| 251 | 253 |
| 252 // Find out which protocol we're supposed to test, and which echo server we | 254 // Find out which protocol we're supposed to test, and which echo server we |
| 253 // should be using, then kick off the tests. | 255 // should be using, then kick off the tests. |
| 254 chrome.test.sendMessage("info_please", onMessageReply); | 256 chrome.test.sendMessage("info_please", onMessageReply); |
| OLD | NEW |