blob: 317b5921c15bd3f19a3c25c95b6779090dafef93 [file] [log] [blame]
<!DOCTYPE HTML>
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
description("Test that WebSocket handshake fails if there are more one Sec-WebSocket-Accept header field in the response.");
window.jsTestIsAsync = true;
function endTest()
{
clearTimeout(timeoutID);
finishJSTest();
}
var url = "ws://localhost:8880/handshake-fail-by-more-accept-header";
var ws = new WebSocket(url);
ws.onopen = function()
{
testFailed("Unexpectedly Connected.");
};
ws.onmessage = function(messageEvent)
{
testFailed("Unexpectedly Received: '" + messageEvent.data + "'");
};
ws.onclose = function()
{
endTest();
};
ws.onerror = function(errorEvent)
{
testPassed("onerror() was called");
};
function timeOutCallback()
{
debug("Timed out in state: " + ws.readyState);
endTest();
}
var timeoutID = setTimeout(timeOutCallback, 3000);
</script>
</body>
</html>