chromium/third_party/blink/web_tests/http/tests/websocket/subresource-filter-disallows.html

<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script>
if (window.testRunner)
  testRunner.setDisallowedSubresourcePathSuffixes(["echo"], true /* block_subresources */);

async_test(t => {
  let ws_allow = new WebSocket("ws://localhost:8880/pong?payload=Hello");
  ws_allow.onopen = t.step_func_done();
}, "Allow websocket connection without matching rule");

async_test(t => {
  let ws_disallow= new WebSocket("ws://localhost:8880/echo");
  ws_disallow.onclose = t.step_func_done();
  ws_disallow.onopen =
      t.unreached_func("Should not open disallowed web socket connections");
}, "Filter websocket connection successfully");
</script>