summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/screen-orientation/fullscreen-interactions.html
blob: cffacc1f4f73e253e13848ac56d4a5a99586b394 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<meta charset="utf-8" />
<meta viewport="width=device-width, initial-scale=1" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script type="module">
  import {
    getOppositeOrientation,
    attachIframe,
  } from "./resources/orientation-utils.js";

  promise_test(async (t) => {
    await test_driver.bless("request full screen");
    await document.documentElement.requestFullscreen();
    const lockPromise = screen.orientation.lock(getOppositeOrientation());
    await document.exitFullscreen();
    await promise_rejects_dom(t, "AbortError", lockPromise);
  }, "Fully unlocking the screen orientation causes a pending lock to be aborted");

  promise_test(async (t) => {
    const iframe = await attachIframe();
    await test_driver.bless("request full screen");
    await document.documentElement.requestFullscreen();
    const lockPromise = iframe.contentWindow.screen.orientation.lock(
      getOppositeOrientation()
    );
    await document.exitFullscreen();
    const frameDOMException = iframe.contentWindow.DOMException;
    await promise_rejects_dom(t, "AbortError", frameDOMException, lockPromise);
  }, "Fully unlocking the screen orientation causes a pending lock in a nested browsing context to be aborted");
</script>