| 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"; |
| 11 var expectedResponsePattern = /0100000005320000005.{11}/; | 11 var expectedResponsePattern = /0100000005320000005.{11}/; |
| 12 | 12 |
| 13 const socket = chrome.experimental.socket; | 13 const socket = chrome.socket; |
| 14 var address; | 14 var address; |
| 15 var bytesWritten = 0; | 15 var bytesWritten = 0; |
| 16 var dataAsString; | 16 var dataAsString; |
| 17 var dataRead = []; | 17 var dataRead = []; |
| 18 var port = -1; | 18 var port = -1; |
| 19 var protocol = "none"; | 19 var protocol = "none"; |
| 20 var socketId = 0; | 20 var socketId = 0; |
| 21 var succeeded = false; | 21 var succeeded = false; |
| 22 var waitCount = 0; | 22 var waitCount = 0; |
| 23 | 23 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 address = parts[1]; | 145 address = parts[1]; |
| 146 port = parseInt(parts[2]); | 146 port = parseInt(parts[2]); |
| 147 console.log("Running tests, protocol " + protocol + ", echo server " + | 147 console.log("Running tests, protocol " + protocol + ", echo server " + |
| 148 address + ":" + port); | 148 address + ":" + port); |
| 149 chrome.test.runTests([ testSocketCreation, testSending ]); | 149 chrome.test.runTests([ testSocketCreation, testSending ]); |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 // Find out which protocol we're supposed to test, and which echo server we | 152 // Find out which protocol we're supposed to test, and which echo server we |
| 153 // should be using, then kick off the tests. | 153 // should be using, then kick off the tests. |
| 154 chrome.test.sendMessage("info_please", onMessageReply); | 154 chrome.test.sendMessage("info_please", onMessageReply); |
| OLD | NEW |