chromium/third_party/blink/web_tests/http/tests/websocket/close-before-handshake-response.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 type="text/javascript">
description("Test if WebSocket fires error and close event when handshake is not received at all.");

window.jsTestIsAsync = true;

var ws = new WebSocket("ws://127.0.0.1:8880/handshake-fail-by-just-close");
ws.onopen = function() {
  testFailed("Unexpected open event");
};
// FIXME: The WebSocket API requires an onerror event to be fired, but for
// compatibility with the old implementation we don't currently test for it.
ws.onclose = function(evt) {
  testPassed("close event");
  wasClean = evt.wasClean;
  shouldBeFalse("wasClean");
  finishJSTest();
};

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