gecko-dev/testing/web-platform/tests/fullscreen/api/element-request-fullscreen-and-exit-iframe-manual.html
Xidorn Quan 93f989c78e Bug 1492746 [wpt PR 13102] - Several fixes to manual fullscreen tests, a=testonly
Automatic update from web-platform-testsSeveral fixes to manual fullscreen tests (#13102)

These tests are made to start after onload so that iframe content
doesn't change anymore:
* fullscreen/api/element-ready-check-containing-iframe-manual.html
* fullscreen/api/element-ready-check-not-allowed-manual.html
* fullscreen/api/element-request-fullscreen-and-exit-iframe-manual.html
* fullscreen/model/move-to-fullscreen-iframe-manual.html

fullscreen/rendering/ua-style-iframe-manual.html is updated to check
each subproperties individually rather than shorthand properties.

fullscreen/api/element-request-fullscreen-timing-manual.html is changed
so that the second test starts after an animation frame to work around
Gecko throttling rAF before the first paint.

Related bugs:
https://bugzilla.mozilla.org/show_bug.cgi?id=1493878
https://github.com/w3c/csswg-drafts/issues/2529
--

wpt-commits: b3c7bf4261939cd1aba9b3264152a718b634ffa7
wpt-pr: 13102
2018-10-08 16:45:21 +00:00

45 lines
1.9 KiB
HTML

<!DOCTYPE html>
<title>Element#requestFullscreen() and Document#exitFullscreen() in iframe</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../trusted-click.js"></script>
<div id="log"></div>
<iframe allowfullscreen></iframe>
<script>
// wait for load event to avoid https://bugzil.la/1493878
window.onload = function() {
async_test(t => {
const iframe = document.querySelector('iframe');
const iframeDoc = iframe.contentDocument;
const iframeBody = iframeDoc.body;
let count = 0;
document.onfullscreenchange = iframeDoc.onfullscreenchange = t.step_func(event => {
count++;
assert_between_inclusive(count, 1, 4, 'number of fullscreenchange events');
// Both when entering and exiting, the fullscreenchange event is fired first
// on the outer document and then on the iframe's document. This is because
// the events are fired in animation frame tasks, which run in "frame tree"
// order.
const expected = {
target: count == 1 || count == 3 ? iframe : iframeBody,
outerFullscreenElement: count <= 2 ? iframe : null,
innerFullscreenElement: count <= 2 ? iframeBody : null,
};
assert_equals(event.target, expected.target, 'event target');
assert_equals(document.fullscreenElement, expected.outerFullscreenElement, 'outer fullscreenElement');
assert_equals(iframeDoc.fullscreenElement, expected.innerFullscreenElement, 'inner fullscreenElement');
if (count == 2) {
iframeDoc.exitFullscreen();
} else if (count == 4) {
// Done, but set timeout to fail on extra events.
step_timeout(t.step_func_done());
}
});
document.onfullscreenerror = t.unreached_func('fullscreenerror event');
iframeDoc.onfullscreenerror = t.unreached_func('iframe fullscreenerror event');
trusted_request(t, iframeBody, iframeBody);
});
};
</script>