OLD | NEW |
---|---|
(Empty) | |
1 <script> | |
2 var hostname = '127.0.0.1'; | |
3 var port = 20202; | |
4 var proxy = "ws://127.0.0.1:10101/tcpproxy"; | |
5 | |
6 function gotMessage(msg) { | |
7 chrome.test.assertEq(msg.data, 'YWxvaGEK'); /* base64-encoded string "aloha\ n" */ | |
Dmitry Polukhin
2011/05/16 09:41:39
Please move comment on separate line.
Denis Lagno
2011/05/17 22:15:07
Done.
| |
8 } | |
9 | |
10 function gotPassport(passport) { | |
11 ws = new WebSocket(proxy); | |
12 | |
13 /* TODO(dilmah): envelope gotMessage into chrome.test.callbackPass after | |
14 setting up testserver */ | |
15 ws.onmessage = gotMessage; | |
16 | |
17 ws.onopen = function() { | |
18 var request = passport + ':' + hostname + ':' + port + ':'; | |
19 ws.send(request); | |
20 | |
21 /* Further on we can send base64-encoded data */ | |
22 ws.send('SEVMTyBsb2NhbGhvc3QK'); /* base64-encoded string "HELO localhost\ n" */ | |
23 }; | |
24 } | |
25 | |
26 function test_connect() { | |
27 chrome.webSocketProxyPrivate.getPassportForTCP( | |
28 hostname, port, chrome.test.callbackPass(gotPassport)); | |
29 } | |
30 | |
31 chrome.test.runTests([test_connect]); | |
32 </script> | |
OLD | NEW |