4 <script src=
"/js-test-resources/js-test.js"></script>
7 <div id=
"description"></div>
8 <div id=
"console"></div>
9 <script type=
"text/javascript">
10 description("Handshake error test");
12 window
.jsTestIsAsync
= true;
16 clearTimeout(timeoutID
);
20 var ws
= new WebSocket("ws://127.0.0.1:8880/handshake-error");
22 ws
.onopen = function()
24 testFailed("Unexpectedly Connected.");
27 ws
.onmessage = function(messageEvent
)
29 testFailed("Unexpectedly Received: '" + messageEvent
.data
+ "'");
32 ws
.onclose = function()
35 shouldBe("ws.readyState", "3")
39 ws
.onerror = function(errorEvent
)
41 testPassed("onerror() was called");
44 function timeOutCallback()
46 testFailed("Timed out in state: " + ws
.readyState
);
50 var timeoutID
= setTimeout(timeOutCallback
, 3000);