Skip to content

Commit

Permalink
Merge b29fb39 into 2a36110
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffcarp committed Dec 13, 2016
2 parents 2a36110 + b29fb39 commit 02e9918
Showing 1 changed file with 38 additions and 0 deletions.
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>

0 comments on commit 02e9918

Please sign in to comment.