chromium/third_party/blink/web_tests/http/tests/fullscreen/fullscreenelement-same-origin.html

<!DOCTYPE HTML>
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
<script src="../resources/pointer-lock/pointer-lock-test-harness.js"></script>
</head>
<body>
<div>
  <div id="target1"></div>
  <iframe src="../resources/pointer-lock/inner-iframe.html" onload="doNextStepWithUserGesture()"></iframe>
</div>
<script>
    description("Test iframe from same origin can not access webkitFullscreenElement.")
    window.jsTestIsAsync = true;

    targetDiv1 = document.getElementById("target1");
    iframe = document.getElementsByTagName("iframe")[0];

    todo = [
      function () {
          document.onwebkitfullscreenchange = function () { doNextStep(); document.onwebkitfullscreenchange = null; }
          targetDiv1.webkitRequestFullscreen();
      },
      function () {
          shouldBe("document.webkitFullscreenElement", "targetDiv1");
          shouldBe("document.webkitCurrentFullScreenElement", "targetDiv1");
          doNextStep();
      },
      function () {
          iframe.contentWindow.postMessage(["eval", 'parent.postMessage(thisFileName() + " document.webkitFullscreenElement = " + document.webkitFullscreenElement, "*")'], "*");
          window.onmessage = function (messageEvent) {
              message = messageEvent.data;
              shouldBeEqualToString("message", "inner-iframe.html document.webkitFullscreenElement = null");
              window.onmessage = null;
              doNextStep();
          }
      },
      function () {
          iframe.contentWindow.postMessage(["eval", 'parent.postMessage(thisFileName() + " document.webkitCurrentFullScreenElement = " + document.webkitCurrentFullScreenElement, "*")'], "*");
          window.onmessage = function (messageEvent) {
              message = messageEvent.data;
              shouldBeEqualToString("message", "inner-iframe.html document.webkitCurrentFullScreenElement = null");
              window.onmessage = null;
              doNextStep();
          }
      },
    ];
    // doNextStep() called by iframe onload handler.
</script>
</body>
</html>