chromium/third_party/blink/web_tests/http/tests/streams/chromium/use-counters.html

<!DOCTYPE html>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';

// TODO(ricea): Is it possible to just import the generated mojom.js?
const kReadableStreamConstructor = 2399;
const kWritableStreamConstructor = 2400;
const kTransformStreamConstructor = 2401;

// Creating a Response should not trigger the kReadableStreamConstructor
// counter.
test(() => {
  new Response('hello');
  assert_false(internals.isUseCounted(document, kReadableStreamConstructor),
             'use should not have been counted');
}, 'use of Response constructor should not be counted as using the ' +
    'ReadableStream constructor');

test(() => {
  new ReadableStream();
  assert_true(internals.isUseCounted(document, kReadableStreamConstructor),
             'use should be counted');
}, 'use of ReadableStream constructor should be counted');

test(() => {
  new WritableStream();
  assert_true(internals.isUseCounted(document, kWritableStreamConstructor),
              'use should be counted');
}, 'use of WritableStream constructor should be counted');

test(() => {
  new TransformStream();
  assert_true(internals.isUseCounted(document, kTransformStreamConstructor),
              'use should be counted');
}, 'use of TransformStream constructor should be counted');
</script>