gecko-dev/testing/web-platform/tests/fullscreen/api/document-exit-fullscreen-twice-manual.html
Dave Tapuska 148e2a6b71 Bug 1464926 [wpt PR 11206] - Migrate fullscreen to use top layer., a=testonly
Automatic update from web-platform-testsMigrate fullscreen to use top layer.

Previous attempts of adding and removing to the top layer were done
synchronously. The spec has been updated to do this asynchronously and
this change matches those changes.

Bug: 240576
Change-Id: Ic57a651596c685daa4b32d78421de5db912c106e
Reviewed-on: https://chromium-review.googlesource.com/1066600
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Christian Biesinger <cbiesinger@chromium.org>
Reviewed-by: Philip Jägenstedt <foolip@chromium.org>
Cr-Commit-Position: refs/heads/master@{#563065}

--

wpt-commits: 1829a42c93e435937db68c8a842fa9b56dd39dc2
wpt-pr: 11206
2018-06-10 09:31:19 +01:00

40 lines
1.5 KiB
HTML

<!DOCTYPE html>
<title>Document#exitFullscreen() called twice</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../trusted-click.js"></script>
<div id="log"></div>
<script>
async_test(t => {
const div = document.querySelector("div");
document.onfullscreenchange = t.step_func(() => {
// We are now in fullscreen.
assert_equals(document.fullscreenElement, div);
// Exit fullscreen twice.
document.exitFullscreen();
assert_equals(document.fullscreenElement, div, "fullscreenElement after first exitFullscreen()");
const secondPromise = document.exitFullscreen();
assert_equals(document.fullscreenElement, div, "fullscreenElement after second exitFullscreen()");
document.onfullscreenchange = t.step_func(event => {
assert_equals(document.fullscreenElement, null);
// Ensure that there's only one fullscreenchange event.
document.onfullscreenchange = t.unreached_func("second fullscreenchange event");
t.step_timeout(() => {
// Done, but if a promise was returned, assert that it is resolved and
// not rejected. This test does not fail if promises aren't implemented.
if (secondPromise) {
secondPromise.then(t.step_func_done(), t.unreached_func("second promise rejected"));
} else {
t.done();
}
}, 0);
});
});
document.onfullscreenerror = t.unreached_func("fullscreenerror event");
trusted_request(t, div);
});
</script>