chromium/third_party/blink/web_tests/http/tests/feature-policy/fullscreen-allowed-by-container-policy-relocate.html

<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="resources/helper.js"></script>
<iframe src="about:blank" allow="fullscreen"></iframe>
<iframe src="about:blank" allow="fullscreen" allowfullscreen></iframe>
<iframe src="about:blank" allowfullscreen></iframe>
<script>
var srcs = [
  "http://localhost:8000/feature-policy/resources/feature-policy-fullscreen.html",
  "resources/feature-policy-fullscreen-relocate.html"
];

function loadFrame(iframe, src) {
  var allowFullscreen = iframe.allowFullscreen;
  var allow = iframe.hasAttribute('allow');
  // fullscreen is enabled if:
  //     a. relocating within the same origin; or
  //     b. relocating across origin, with allowfullscreen not overriden by
  //        container policy.
  var expectedEnabled =
    (src === srcs[0]) || (src === srcs[1] && iframe.allowFullscreen && !allow)
  promise_test(function() {
    iframe.src = src;
    return new Promise(function(resolve, reject) {
      window.addEventListener('message', function(e) {
          resolve(e.data);
      }, { once: true });
    }).then(function(data) {
      if (expectedEnabled) {
        assert_true(data.enabled, 'Document.fullscreenEnabled:');
        assert_equals(data.type, 'change', 'Document.requestFullscreen():');
      } else {
        assert_false(data.enabled, 'Document.fullscreenEnabled:');
        assert_equals(data.type, 'error', 'Document.requestFullscreen():');
      }
    });
  }, 'Iframe src set to ' + src + ', allowpaymentrequest = ' +
  allowFullscreen + ', allow = ' + (allow ? 'fullscreen' : 'undefined') +
  ', fullscreen is ' + (expectedEnabled ? 'enabled' : 'disabled') +
  ' by container policy.');
}

window.onload = function() {
  loadIframes(srcs);
}
</script>