From 240e5f59b166afcfacd1a49378b3a50d1332dee8 Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Wed, 25 Apr 2012 13:44:37 -0500 Subject: [PATCH] Fix latency test. For echo/latency tests default to current host:port or URL. --- tests/echo.html | 4 +- tests/echo.py | 2 +- tests/latency.html | 4 +- tests/plain_echo.html | 168 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 173 insertions(+), 5 deletions(-) create mode 100644 tests/plain_echo.html diff --git a/tests/echo.html b/tests/echo.html index f7269e0..cc8b642 100644 --- a/tests/echo.html +++ b/tests/echo.html @@ -140,8 +140,8 @@ window.onload = function() { console.log("onload"); var url = document.location.href; - $D('host').value = (url.match(/host=([^&#]*)/) || ['',''])[1]; - $D('port').value = (url.match(/port=([^&#]*)/) || ['',''])[1]; + $D('host').value = (url.match(/host=([^&#]*)/) || ['',window.location.hostname])[1]; + $D('port').value = (url.match(/port=([^&#]*)/) || ['',window.location.port])[1]; } diff --git a/tests/echo.py b/tests/echo.py index 31f2fa9..878c31a 100755 --- a/tests/echo.py +++ b/tests/echo.py @@ -45,7 +45,7 @@ class WebSocketEcho(WebSocketServer): if self.client in ins: # Receive client data, decode it, and send it back frames, closed = self.recv_frames() - cqueue.extend(["You said: " + f for f in frames]) + cqueue.extend(frames) if closed: self.send_close() diff --git a/tests/latency.html b/tests/latency.html index 4e1b55c..74538a4 100644 --- a/tests/latency.html +++ b/tests/latency.html @@ -281,8 +281,8 @@ message("initializing web-socket-js flash bridge"); } var url = document.location.href; - $D('host').value = (url.match(/host=([^&#]*)/) || ['',''])[1]; - $D('port').value = (url.match(/port=([^&#]*)/) || ['',''])[1]; + $D('host').value = (url.match(/host=([^&#]*)/) || ['',window.location.hostname])[1]; + $D('port').value = (url.match(/port=([^&#]*)/) || ['',window.location.port])[1]; $D('payload_size').value = payload_size; } diff --git a/tests/plain_echo.html b/tests/plain_echo.html new file mode 100644 index 0000000..12926fb --- /dev/null +++ b/tests/plain_echo.html @@ -0,0 +1,168 @@ + + + + WebSockets Echo Test + + + + + + + + + + + Host:   + Port:   + Encrypt:   +   + + +
+ Log:
+ + + + + + +