2010-03-05 Fumitoshi Ukai <ukai@chromium.org>
authorukai@chromium.org <ukai@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Mar 2010 09:51:39 +0000 (09:51 +0000)
committerukai@chromium.org <ukai@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Mar 2010 09:51:39 +0000 (09:51 +0000)
        Reviewed by Alexey Proskuryakov.

        WebSocket test to transfer null character
        https://bugs.webkit.org/show_bug.cgi?id=35715

        * websocket/tests/null-character-expected.txt: Added.
        * websocket/tests/null-character.html: Added.
        * websocket/tests/script-tests/null-character.js: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@55574 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/websocket/tests/null-character-expected.txt [new file with mode: 0644]
LayoutTests/websocket/tests/null-character.html [new file with mode: 0644]
LayoutTests/websocket/tests/script-tests/null-character.js [new file with mode: 0644]

index 7862a33..c315b21 100644 (file)
@@ -2,6 +2,17 @@
 
         Reviewed by Alexey Proskuryakov.
 
+        WebSocket test to transfer null character
+        https://bugs.webkit.org/show_bug.cgi?id=35715
+
+        * websocket/tests/null-character-expected.txt: Added.
+        * websocket/tests/null-character.html: Added.
+        * websocket/tests/script-tests/null-character.js: Added.
+
+2010-03-05  Fumitoshi Ukai  <ukai@chromium.org>
+
+        Reviewed by Alexey Proskuryakov.
+
         WebSocket onmessageerror event handler
         https://bugs.webkit.org/show_bug.cgi?id=35570
 
diff --git a/LayoutTests/websocket/tests/null-character-expected.txt b/LayoutTests/websocket/tests/null-character-expected.txt
new file mode 100644 (file)
index 0000000..6fca377
--- /dev/null
@@ -0,0 +1,12 @@
+Make sure WebSocket transfer null character
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+WebSocket open
+msg should not be split by frame char \xff\0
+PASS msg is expectedMessage
+WebSocket closed
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/websocket/tests/null-character.html b/LayoutTests/websocket/tests/null-character.html
new file mode 100644 (file)
index 0000000..f227f1a
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script src="script-tests/null-character.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/websocket/tests/script-tests/null-character.js b/LayoutTests/websocket/tests/script-tests/null-character.js
new file mode 100644 (file)
index 0000000..3e2b5f1
--- /dev/null
@@ -0,0 +1,38 @@
+description("Make sure WebSocket transfer null character");
+
+if (window.layoutTestController)
+    layoutTestController.waitUntilDone();
+
+function finish()
+{
+    isSuccessfullyParsed();
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+}
+
+var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/echo");
+// \xff in string would be \xc3\xbf on websocket connection (UTF-8)
+var expectedMessage = "Should Not\xff\0Split";
+
+ws.onopen = function()
+{
+    debug("WebSocket open");
+    ws.send(expectedMessage);
+};
+
+var msg;
+ws.onmessage = function(messageEvent)
+{
+    msg = messageEvent.data;
+    debug("msg should not be split by frame char \\xff\\0");
+    shouldBe("msg", "expectedMessage");
+    ws.close();
+};
+
+ws.onclose = function()
+{
+    debug("WebSocket closed");
+    finish();
+};
+
+var successfullyParsed = true;