Index: chrome/test/data/extensions/api_test/web_socket_proxy_private/background.html |
diff --git a/chrome/test/data/extensions/api_test/web_socket_proxy_private/background.html b/chrome/test/data/extensions/api_test/web_socket_proxy_private/background.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8fd14c5090037948dc08a169c5e1ec3aba413624 |
--- /dev/null |
+++ b/chrome/test/data/extensions/api_test/web_socket_proxy_private/background.html |
@@ -0,0 +1,32 @@ |
+<script> |
+ var hostname = '127.0.0.1'; |
+ var port = 20202; |
+ var proxy = "ws://127.0.0.1:10101/tcpproxy"; |
+ |
+ function gotMessage(msg) { |
+ chrome.test.assertEq(msg.data, 'YWxvaGEK'); /* base64-encoded string "aloha\n" */ |
Dmitry Polukhin
2011/05/17 10:58:39
Please use atob/btoa to make code more readable. A
Denis Lagno
2011/05/17 22:15:08
Done.
|
+ } |
+ |
+ function gotPassport(passport) { |
+ ws = new WebSocket(proxy); |
+ |
+ /* TODO(dilmah): envelope gotMessage into chrome.test.callbackPass after |
+ setting up testserver */ |
+ ws.onmessage = gotMessage; |
+ |
+ ws.onopen = function() { |
+ var request = passport + ':' + hostname + ':' + port + ':'; |
+ ws.send(request); |
+ |
+ /* Further on we can send base64-encoded data */ |
+ ws.send('SEVMTyBsb2NhbGhvc3QK'); /* base64-encoded string "HELO localhost\n" */ |
+ }; |
+ } |
+ |
+ function test_connect() { |
+ chrome.webSocketProxyPrivate.getPassportForTCP( |
+ hostname, port, chrome.test.callbackPass(gotPassport)); |
+ } |
+ |
+ chrome.test.runTests([test_connect]); |
+</script> |