chromium/third_party/blink/web_tests/http/tests/websocket/send-empty.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("WebSocket: Calling send() without arguments should raise SyntaxError.");

window.jsTestIsAsync = true;

var ws = new WebSocket("ws://127.0.0.1:8880/echo");

var closeEvent;
var receivedMessages = [];
var expectedMessages = ["Goodbye"];

ws.onopen = function()
{
    shouldThrow("ws.send()");
    ws.send("Goodbye");
};

ws.onmessage = function(event)
{
    receivedMessages.push(event.data);
};

ws.onclose = function(event)
{
    closeEvent = event;
    shouldBeTrue("closeEvent.wasClean");

    shouldEvaluateTo("receivedMessages.length", expectedMessages.length);
    for (var i = 0; i < expectedMessages.length; ++i)
        shouldBeEqualToString("receivedMessages[" + i + "]", expectedMessages[i]);
    finishJSTest();
};

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