chromium/third_party/blink/web_tests/fast/dom/Document/document-open-use-counters-0args.html

<!DOCTYPE html>
<meta charset="utf-8">
<title>document.open UseCounters with no arguments</title>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<body>
<script>
const DocumentOpenTwoArgs = 2494; // From public/mojom/use_counter/metrics/web_feature.mojom
const DocumentOpenTwoArgsWithReplace = 2495; // From public/mojom/use_counter/metrics/web_feature.mojom
const DocumentOpenThreeArgs = 2496; // From public/mojom/use_counter/metrics/web_feature.mojom

test(() => {
  const frame = document.body.appendChild(document.createElement('iframe'));
  try {
    assert_false(internals.isUseCounted(frame.contentDocument, DocumentOpenTwoArgs), "DocumentOpenTwoArgs: before");
    assert_false(internals.isUseCounted(frame.contentDocument, DocumentOpenTwoArgsWithReplace), "DocumentOpenTwoArgsWithReplace: before");
    assert_false(internals.isUseCounted(frame.contentDocument, DocumentOpenThreeArgs), "DocumentOpenThreeArgs: before");
    frame.contentDocument.open();
    assert_true(internals.isUseCounted(frame.contentDocument, DocumentOpenTwoArgs), "DocumentOpenTwoArgs: after");
    assert_false(internals.isUseCounted(frame.contentDocument, DocumentOpenTwoArgsWithReplace), "DocumentOpenTwoArgsWithReplace: after");
    assert_false(internals.isUseCounted(frame.contentDocument, DocumentOpenThreeArgs), "DocumentOpenThreeArgs: after");
  } finally {
    frame.remove();
  }
}, 'document.open() with zero arguments');
</script>
</body>