Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for exiting from nested fullscreen
Tests for whatwg/fullscreen#72. Before that change, the per-spec pass condition for the nested-in-iframe case would have been to exit fully to the outer document, which was a spec bug and doesn't match implementations. In order to automate these tests, it was necessary to teach auto-click.js to traverse out of iframes to take their position into account. These tests have also been run manually in Firefox Nightly and confirmed to pass there. Actually adopting the new spec wording will be part of relanding issue 402376, together with other necessary spec changes. BUG=402376 Review-Url: https://codereview.chromium.org/2706293013 Cr-Commit-Position: refs/heads/master@{#452841}
- Loading branch information
Showing
2 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
fullscreen/api/document-exit-fullscreen-nested-in-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,40 @@ | ||
<!DOCTYPE html> | ||
<title>Document#exitFullscreen() for nested fullscreen inside an iframe</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="../trusted-click.js"></script> | ||
<iframe allowfullscreen></iframe> | ||
<script> | ||
window.t = async_test(); | ||
t.step(() => { | ||
const iframe = document.querySelector("iframe"); | ||
iframe.srcdoc = "<div><div></div></div>"; | ||
iframe.onload = t.step_func(() => { | ||
const doc = iframe.contentDocument; | ||
const outer = doc.querySelector("div"); | ||
const inner = outer.firstChild; | ||
|
||
// First request fullscreen for the outer element. | ||
trusted_request(t, outer); | ||
doc.onfullscreenchange = t.step_func(() => { | ||
assert_equals(document.fullscreenElement, iframe); | ||
assert_equals(doc.fullscreenElement, outer); | ||
|
||
// Then request fullscreen for the inner element. | ||
trusted_request(t, inner); | ||
doc.onfullscreenchange = t.step_func(() => { | ||
assert_equals(document.fullscreenElement, iframe); | ||
assert_equals(doc.fullscreenElement, inner); | ||
|
||
// Now exit fullscreen for the iframe's content document. | ||
doc.exitFullscreen(); | ||
doc.onfullscreenchange = t.step_func_done(() => { | ||
assert_equals(document.fullscreenElement, iframe); | ||
assert_equals(doc.fullscreenElement, outer); | ||
}); | ||
}); | ||
}); | ||
doc.onfullscreenerror = t.unreached_func("fullscreenerror event"); | ||
}); | ||
}); | ||
</script> |
31 changes: 31 additions & 0 deletions
31
fullscreen/api/document-exit-fullscreen-nested-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,31 @@ | ||
<!DOCTYPE html> | ||
<title>Document#exitFullscreen() for nested fullscreen</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="../trusted-click.js"></script> | ||
<div><div></div></div> | ||
<script> | ||
async_test(t => { | ||
const outer = document.querySelector("div"); | ||
const inner = outer.firstChild; | ||
|
||
// First request fullscreen for the outer element. | ||
trusted_request(t, outer); | ||
document.onfullscreenchange = t.step_func(() => { | ||
assert_equals(document.fullscreenElement, outer); | ||
|
||
// Then request fullscreen for the inner element. | ||
trusted_request(t, inner); | ||
document.onfullscreenchange = t.step_func(() => { | ||
assert_equals(document.fullscreenElement, inner); | ||
|
||
// Now exit fullscreen. | ||
document.exitFullscreen(); | ||
document.onfullscreenchange = t.step_func_done(() => { | ||
assert_equals(document.fullscreenElement, outer); | ||
}); | ||
}); | ||
}); | ||
document.onfullscreenerror = t.unreached_func("fullscreenerror event"); | ||
}); | ||
</script> |