chromium/third_party/blink/web_tests/http/tests/websocket/broken-utf8.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 aborts the connection when it receives a text frame containing broken UTF-8 data.");

window.jsTestIsAsync = true;

var ws = new WebSocket("ws://127.0.0.1:8880/broken-utf8");
var closeEvent;

ws.onopen = function()
{
    debug("onopen() was called.");
};

ws.onerror = function(event)
{
    debug("onerror() was called.");
};

ws.onmessage = function(event)
{
    var message = event.data;
    testFailed("onmessage() was called. (message = \"" + message + "\")");
};

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

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