| Index: third_party/WebKit/LayoutTests/fullscreen/api/document-exit-fullscreen-vs-request.html
|
| diff --git a/third_party/WebKit/LayoutTests/fullscreen/api/document-exit-fullscreen-vs-request.html b/third_party/WebKit/LayoutTests/fullscreen/api/document-exit-fullscreen-vs-request.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c1337e466a8a97fbc5ce8180701552f0ec1fcd1a
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/fullscreen/api/document-exit-fullscreen-vs-request.html
|
| @@ -0,0 +1,43 @@
|
| +<!DOCTYPE html>
|
| +<title>Document#exitFullscreen() vs. Element#requestFullscreen()</title>
|
| +<script src="../../resources/testharness.js"></script>
|
| +<script src="../../resources/testharnessreport.js"></script>
|
| +<script src="../trusted-event.js"></script>
|
| +<div id="log"></div>
|
| +<div id="target"></div>
|
| +<script>
|
| +// Adapted from https://github.com/w3c/web-platform-tests/pull/4250
|
| +// TODO(foolip): Remove this test when the above is imported and passing.
|
| +async_test(t => {
|
| + const target = document.getElementById("target");
|
| + trusted_request(target);
|
| +
|
| + document.onfullscreenchange = t.step_func(() => {
|
| + document.onfullscreenchange = t.unreached_func("fullscreenchange event");
|
| + // We are now in fullscreen, so exiting requires a resize but requesting
|
| + // does not.
|
| + trusted_event(t.step_func(() => {
|
| + // Request fullscreen on the current fullscreen element, to ensure there
|
| + // is no short circuiting and that both requests fail. Note that the order
|
| + // of the two fullscreenerror events relative to the fullscreenchange
|
| + // event isn't tested, as it depends on whether the resize happens before
|
| + // the next animation frame or not.
|
| +
|
| + let fullscreenchanges = 0;
|
| + document.onfullscreenchange = t.step_func((event) => {
|
| + fullscreenchanges++;
|
| + if (fullscreenchanges == 3) {
|
| + assert_equals(document.fullscreenElement, null);
|
| + t.done();
|
| + }
|
| + });
|
| + document.onfullscreenerror = t.unreached_func("fullscreenerror event");
|
| +
|
| + assert_equals(document.fullscreenElement, target);
|
| + target.requestFullscreen();
|
| + document.exitFullscreen();
|
| + target.requestFullscreen();
|
| + }), target);
|
| + });
|
| +});
|
| +</script>
|
|
|