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

Unified Diff: chrome/test/data/extensions/api_test/web_socket_proxy_private/background.html

Issue 6683060: Private API for extensions like ssh-client that need access to TCP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removed changes to rand_util_unittest Created 9 years, 7 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/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..9b2034e36aef3a75fe9a184a3376e44ecefdb074
--- /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, window.btoa("aloha\n"));
+ }
+
+ 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(window.btoa("HELO localhost\n"));
+ };
+ }
+
+ function test_connect() {
+ chrome.webSocketProxyPrivate.getPassportForTCP(
+ hostname, port, chrome.test.callbackPass(gotPassport));
+ }
+
+ chrome.test.runTests([test_connect]);
+</script>

Powered by Google App Engine
This is Rietveld 408576698