-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
fullscreen/api/element-request-fullscreen-and-exit-iframe-manual.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!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> | ||
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'); | ||
const expected = { | ||
target: count == 1 || count == 4 ? document : iframeDoc, | ||
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. | ||
setTimeout(t.step_func_done()); | ||
} | ||
}); | ||
document.onfullscreenerror = t.unreached_func('fullscreenerror event'); | ||
iframeDoc.onfullscreenerror = t.unreached_func('iframe fullscreenerror event'); | ||
|
||
trusted_request(iframeBody, document.body); | ||
}); | ||
</script> |