chromium/third_party/blink/web_tests/http/tests/websocket/permessage-deflate-set-bfinal.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 receiving compressed frames with BFINAL = 1.");

window.jsTestIsAsync = true;

var closeEvent;
var ws;
var messageIndex;

var messages = [
    "Hello",
    "World",
    "Goodbye"
];

ws = new WebSocket("ws://localhost:8880/permessage-deflate?set_bfinal");

ws.onopen = function(event)
{
    messageIndex = 0;
    debug("Sending message: \"" + messages[messageIndex] + "\"");
    ws.send(messages[messageIndex]);
};

ws.onmessage = function(event)
{
    shouldBe("event.data", "'" + messages[messageIndex] + "'");
    if (messageIndex === messages.length - 1)
        ws.close();
    else {
        messageIndex += 1;
        debug("Sending message: \"" + messages[messageIndex] + "\"");
        ws.send(messages[messageIndex]);
    }
};

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

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