chromium/third_party/blink/web_tests/http/tests/websocket/unpaired-surrogates-in-close-reason.html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script type="text/javascript">
description("Checks whether unpaired surrogates in a close reason are silently converted to U+FFFD and SYNTAX_ERR is not thrown.");

window.jsTestIsAsync = true;

var ws = new WebSocket("ws://localhost:8880/echo");
var message;
var closeEvent;

ws.onopen = function()
{
    debug("Connected.");
    ws.close(1000, '\uD807');
};

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

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

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