chromium/third_party/blink/web_tests/http/tests/websocket/extensions.html

<!DOCTYPE html>
<script src="/js-test-resources/js-test.js"></script>
<script src="resources/get-request-header.js"></script>
<script>
description("Test WebSocket.extensions attribute.");

window.jsTestIsAsync = true;

var ws = new WebSocket(WS_ECHO_REQUEST_HEADERS_URL);
debug("Check the value before opening the connection:");
shouldBeEqualToString("ws.extensions", "");

// extensions attribute is read-only.
debug("Check if the value is read only:");
shouldBeEqualToString("ws.extensions = 'foo'; ws.extensions", "");

ws.onopen = function(event)
{
    debug("Check the value after the connection is established:");
    shouldBeEqualToString("ws.extensions", "permessage-deflate");
};

var extensions_requested;
ws.onmessage = function(event)
{
    debug("Check the value of the Sec-WebSocket-Extensions header sent to the server:");
    extensions_requested = getRequestHeaderFromEvent(event, "sec-websocket-extensions");
    shouldBeEqualToString("extensions_requested", "permessage-deflate; client_max_window_bits");
    finishJSTest();
};

</script>