2011-07-05 Yuta Kitamura <yutak@chromium.org>
[WebKit-https.git] / LayoutTests / http / tests / websocket / tests / hixie76 / error-detect.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <link rel="stylesheet" href="../../../../js-test-resources/js-test-style.css">
5 <script src="../../../../js-test-resources/js-test-pre.js"></script>
6 </head>
7 <body>
8 <div id="description"></div>
9 <div id="console"></div>
10 <script type="text/javascript">
11 description("Make sure WebSocket correctly fire error event for unknown frame type.");
12
13 window.jsTestIsAsync = true;
14
15 var errorCount = 0;
16
17 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/hixie76/unknown-frame-type");
18 ws.onopen = function () {
19     debug("WebSocket is open");
20 };
21 ws.onmessage = function (evt) {
22     debug("received:" + evt.data);
23 };
24 ws.onerror = function () {
25     errorCount += 1;
26 };
27 ws.onclose = function () {
28     debug("WebSocket is closed");
29     shouldBe("errorCount", "255");
30     finishJSTest();
31 };
32
33 var successfullyParsed = true;
34 </script>
35 <script src="../../../../js-test-resources/js-test-post.js"></script>
36 </body>
37 </html>