chromium/third_party/blink/web_tests/http/tests/websocket/handshake-fail-by-no-accept-header.html

<!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 whether WebSocket handshake fails if the server does not send Sec-WebSocket-Accept header.");

window.jsTestIsAsync = true;

var url = "ws://localhost:8880/handshake-fail-by-no-accept-header";
var ws = new WebSocket(url);
var closeEvent;

ws.onopen = function()
{
    testFailed("Connection established.");
    ws.close();
};

ws.onclose = function(event)
{
    closeEvent = event;
    shouldBeFalse("closeEvent.wasClean");
    finishJSTest();
};

ws.onerror = function(errorEvent)
{
    testPassed("onerror() was called");
};

</script>
</body>
</html>