[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.17-1283-gcf603cf
ap at apple.com
ap at apple.com
Tue Jan 5 23:41:53 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit dbc630c3fa98b51f6ae0f3263c6ab04e2b14b4f9
Author: ap at apple.com <ap at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Dec 3 21:06:07 2009 +0000
Reviewed by Eric Seidel.
https://bugs.webkit.org/show_bug.cgi?id=32130
Add a test for sending non-trivial amount of data over WebSocket
* websocket/tests/echo_wsh.py: Copied from WebKitTools/pywebsocket/example/echo_wsh.py.
* websocket/tests/simple-stress-expected.txt: Added.
* websocket/tests/simple-stress.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51654 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 31c0edb..30efdcf 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2009-12-03 Alexey Proskuryakov <ap at apple.com>
+
+ Reviewed by Eric Seidel.
+
+ https://bugs.webkit.org/show_bug.cgi?id=32130
+ Add a test for sending non-trivial amount of data over WebSocket
+
+ * websocket/tests/echo_wsh.py: Copied from WebKitTools/pywebsocket/example/echo_wsh.py.
+ * websocket/tests/simple-stress-expected.txt: Added.
+ * websocket/tests/simple-stress.html: Added.
+
2009-12-03 Brady Eidson <beidson at apple.com>
Rubberstamped by Sam Weinig.
diff --git a/LayoutTests/websocket/tests/echo_wsh.py b/LayoutTests/websocket/tests/echo_wsh.py
new file mode 100644
index 0000000..79c3f10
--- /dev/null
+++ b/LayoutTests/websocket/tests/echo_wsh.py
@@ -0,0 +1,46 @@
+# Copyright 2009, Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+from mod_pywebsocket import msgutil
+
+
+_GOODBYE_MESSAGE = 'Goodbye'
+
+
+def web_socket_do_extra_handshake(request):
+ pass # Always accept.
+
+
+def web_socket_transfer_data(request):
+ while True:
+ line = msgutil.receive_message(request)
+ msgutil.send_message(request, line)
+ if line == _GOODBYE_MESSAGE:
+ return
diff --git a/LayoutTests/websocket/tests/simple-stress-expected.txt b/LayoutTests/websocket/tests/simple-stress-expected.txt
new file mode 100644
index 0000000..f57c3ec
--- /dev/null
+++ b/LayoutTests/websocket/tests/simple-stress-expected.txt
@@ -0,0 +1,7 @@
+Test sending many messages, and sending a large message.
+
+Should say PASS:
+
+Running the test...
+PASS
+
diff --git a/LayoutTests/websocket/tests/simple-stress.html b/LayoutTests/websocket/tests/simple-stress.html
new file mode 100644
index 0000000..d9ef8d5
--- /dev/null
+++ b/LayoutTests/websocket/tests/simple-stress.html
@@ -0,0 +1,52 @@
+<p>Test sending many messages, and sending a large message.</p>
+<p>Should say PASS:</p>
+<pre id=log>Running the test...
+</pre>
+<script>
+var numSmallMessages = 1000;
+
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("log").innerHTML += message + "\n";
+}
+
+var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/echo");
+
+ws.onopen = function() {
+ for (i = 0; i < numSmallMessages; ++i) {
+ ws.send(i);
+ }
+
+}
+
+var lastMessage = -1;
+ws.onmessage = function(msg) {
+ if (parseInt(msg.data) != lastMessage + 1)
+ log("FAIL - out of sequence response. Expected " + lastMessage + 1 + ", got " + msg.data);
+ ++lastMessage;
+ if (lastMessage == numSmallMessages - 1)
+ testLargeString();
+}
+
+function testLargeString()
+{
+ // Build a string 256K in length.
+ var str = " ";
+ for (i = 0; i < 18; ++i)
+ str += str;
+
+ ws.send(str);
+ ws.onmessage = function(msg) {
+ log(msg.data.length == str.length ? "PASS" : "FAIL - wrong response length");
+ ws.send("Goodbye");
+ ws.onmessage = null;
+ if (window.layoutTestController)
+ setTimeout("layoutTestController.notifyDone()", 0);
+ }
+}
+</script>
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list