Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Unified Diff: third_party/WebKit/LayoutTests/fullscreen/api/document-exit-fullscreen-vs-request.html

Issue 2573773002: Sync requestFullscreen() and exitFullscreen() algorithms with the spec (Closed)
Patch Set: address feedback Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fullscreen/api/document-exit-fullscreen-vs-request.html
diff --git a/third_party/WebKit/LayoutTests/fullscreen/api/document-exit-fullscreen-vs-request.html b/third_party/WebKit/LayoutTests/fullscreen/api/document-exit-fullscreen-vs-request.html
index 54f2afcd73ef43243bc34d838e57e1955b0b3029..2c402e5bd3e2aa5e989985759b583f71d2834f5b 100644
--- a/third_party/WebKit/LayoutTests/fullscreen/api/document-exit-fullscreen-vs-request.html
+++ b/third_party/WebKit/LayoutTests/fullscreen/api/document-exit-fullscreen-vs-request.html
@@ -4,12 +4,14 @@
<script src="../../resources/testharnessreport.js"></script>
<script src="../trusted-click.js"></script>
<div id="log"></div>
-<div id="parent"><div></div></div>
+<div id="parent"><div><div></div></div></div>
<script>
// Adapted from https://github.com/w3c/web-platform-tests/pull/4250
// TODO(foolip): Remove this test when the above is imported and passing.
async_test(t => {
const parent = document.getElementById("parent");
+ const child = parent.firstChild;
+ const grandChild = child.firstChild;
document.onfullscreenchange = t.step_func(() => {
// We are now in fullscreen, so exiting requires a resize but requesting
@@ -20,23 +22,26 @@ async_test(t => {
// Request fullscreen on another element, to avoid any synchronous
// short-circuiting on document.fullscreenElement.requestFullscreen(),
// which used to be in the spec. Also request both before and after the
- // exit. Both requests should be silently ignored due to the exit.
+ // exit. Both requests synchronously enqueue animation frame tasks. They
+ // may run after exiting, but still before the animation frame task for
+ // the exit, and so both will succeed, and there will be 3
+ // fullscreenchange events, but not matching the order of the calls.
- let fullscreenchanges = 0;
- document.onfullscreenchange = t.step_func((event) => {
- assert_equals(document.fullscreenElement, child);
- fullscreenchanges++;
- if (fullscreenchanges == 3)
+ let i = 0;
+ const expected = [child, grandChild, null];
+ document.onfullscreenchange = t.step_func(() => {
+ assert_equals(document.fullscreenElement, expected[i], "fullscreenElement when i=" + i);
+ i++;
+ if (i == 3)
t.done();
});
- const child = parent.firstChild;
child.requestFullscreen();
- assert_equals(document.fullscreenElement, child, "fullscreenElement after first requestFullscreen()");
+ assert_equals(document.fullscreenElement, parent, "fullscreenElement after first requestFullscreen()");
document.exitFullscreen();
assert_equals(document.fullscreenElement, parent, "fullscreenElement after exitFullscreen()");
- child.requestFullscreen();
- assert_equals(document.fullscreenElement, child, "fullscreenElement after second requestFullscreen()");
+ grandChild.requestFullscreen();
+ assert_equals(document.fullscreenElement, parent, "fullscreenElement after second requestFullscreen()");
}), parent);
});
document.onfullscreenerror = t.unreached_func("fullscreenerror event");

Powered by Google App Engine
This is Rietveld 408576698