chromium/third_party/blink/web_tests/http/tests/websocket/unmasked-frames.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("Receive unmasked WebSocket frames.");

window.jsTestIsAsync = true;

var url = "ws://localhost:8880/unmasked-frames";
var ws = new WebSocket(url);
var closeEvent;
var expectedMessages = ["First message", "Fragmented message", ""];
var actualMessages = [];

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

ws.onmessage = function(event)
{
    var message = event.data;
    debug("onmessage() was called. (message = \"" + message + "\")");
    if (message === "END") {
        ws.close();
        return;
    }
    actualMessages.push(message);
};

ws.onclose = function(event)
{
    closeEvent = event;
    shouldBeTrue("actualMessages.length === expectedMessages.length");
    for (var i = 0; i < expectedMessages.length; ++i)
        shouldBeEqualToString("actualMessages[" + i + "]", expectedMessages[i]);
    shouldBeTrue("closeEvent.wasClean");
    finishJSTest();
};

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