summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/fullscreen
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/fullscreen')
-rw-r--r--testing/web-platform/tests/fullscreen/OWNERS2
-rw-r--r--testing/web-platform/tests/fullscreen/api/document-exit-fullscreen-manual.html24
-rw-r--r--testing/web-platform/tests/fullscreen/api/document-fullscreen-element-manual.html32
-rw-r--r--testing/web-platform/tests/fullscreen/api/document-fullscreen-enabled.html17
-rw-r--r--testing/web-platform/tests/fullscreen/api/document-onfullscreenchange-manual.html15
-rw-r--r--testing/web-platform/tests/fullscreen/api/document-onfullscreenerror.html13
-rw-r--r--testing/web-platform/tests/fullscreen/api/element-ready-check-containing-iframe-manual.html21
-rw-r--r--testing/web-platform/tests/fullscreen/api/element-ready-check-enabled-flag-not-set-manual.html19
-rw-r--r--testing/web-platform/tests/fullscreen/api/element-ready-check-fullscreen-element-sibling-manual.html23
-rw-r--r--testing/web-platform/tests/fullscreen/api/element-ready-check-fullscreen-iframe-child-manual.html28
-rw-r--r--testing/web-platform/tests/fullscreen/api/element-ready-check-iframe-child-manual.html17
-rw-r--r--testing/web-platform/tests/fullscreen/api/element-ready-check-not-in-document-manual.html15
-rw-r--r--testing/web-platform/tests/fullscreen/api/element-request-fullscreen-manual.html22
-rw-r--r--testing/web-platform/tests/fullscreen/api/element-request-fullscreen-non-top-manual.html28
-rw-r--r--testing/web-platform/tests/fullscreen/api/element-request-fullscreen-svg-rect-manual.html17
-rw-r--r--testing/web-platform/tests/fullscreen/api/element-request-fullscreen-svg-svg-manual.html17
-rw-r--r--testing/web-platform/tests/fullscreen/api/element-request-fullscreen-top-manual.html30
-rw-r--r--testing/web-platform/tests/fullscreen/model/remove-child-manual.html28
-rw-r--r--testing/web-platform/tests/fullscreen/model/remove-first-manual.html32
-rw-r--r--testing/web-platform/tests/fullscreen/model/remove-last-manual.html32
-rw-r--r--testing/web-platform/tests/fullscreen/model/remove-parent-manual.html26
-rw-r--r--testing/web-platform/tests/fullscreen/model/remove-single-manual.html24
-rw-r--r--testing/web-platform/tests/fullscreen/trusted-click.js24
23 files changed, 506 insertions, 0 deletions
diff --git a/testing/web-platform/tests/fullscreen/OWNERS b/testing/web-platform/tests/fullscreen/OWNERS
new file mode 100644
index 000000000..dd7cb4169
--- /dev/null
+++ b/testing/web-platform/tests/fullscreen/OWNERS
@@ -0,0 +1,2 @@
+@foolip
+@upsuper
diff --git a/testing/web-platform/tests/fullscreen/api/document-exit-fullscreen-manual.html b/testing/web-platform/tests/fullscreen/api/document-exit-fullscreen-manual.html
new file mode 100644
index 000000000..3b0d28397
--- /dev/null
+++ b/testing/web-platform/tests/fullscreen/api/document-exit-fullscreen-manual.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<title>Document.exitFullscreen()</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../trusted-click.js"></script>
+<div id="log"></div>
+<script>
+async_test(function(t)
+{
+ trusted_request(document.querySelector("div"));
+
+ document.addEventListener("fullscreenchange", t.step_func(function()
+ {
+ if (document.fullscreenElement) {
+ document.exitFullscreen();
+ } else {
+ assert_equals(event.target, document, "event.target");
+ assert_false(event.bubbles, "event.bubbles");
+ assert_false(event.cancelable, "event.cancelable");
+ t.done();
+ }
+ }));
+});
+</script>
diff --git a/testing/web-platform/tests/fullscreen/api/document-fullscreen-element-manual.html b/testing/web-platform/tests/fullscreen/api/document-fullscreen-element-manual.html
new file mode 100644
index 000000000..473bdbb0f
--- /dev/null
+++ b/testing/web-platform/tests/fullscreen/api/document-fullscreen-element-manual.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<title>Document.fullscreenElement</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../trusted-click.js"></script>
+<div id="log"></div>
+<script>
+async_test(function(t)
+{
+ var div = document.querySelector("div");
+
+ document.onfullscreenchange = t.step_func(function()
+ {
+ assert_equals(document.fullscreenElement, div, "fullscreenElement before exitFullscreen()");
+ document.exitFullscreen();
+ assert_equals(document.fullscreenElement, div, "fullscreenElement after exitFullscreen()");
+
+ document.onfullscreenchange = t.step_func(function()
+ {
+ assert_equals(document.fullscreenElement, null, "fullscreenElement after exiting fullscreen");
+ t.done();
+ });
+ });
+
+ trusted_click(t.step_func(function()
+ {
+ assert_equals(document.fullscreenElement, null, "fullscreenElement before requestFullscreen()");
+ div.requestFullscreen();
+ assert_equals(document.fullscreenElement, null, "fullscreenElement after requestFullscreen()");
+ }), document.body);
+});
+</script>
diff --git a/testing/web-platform/tests/fullscreen/api/document-fullscreen-enabled.html b/testing/web-platform/tests/fullscreen/api/document-fullscreen-enabled.html
new file mode 100644
index 000000000..d45bb1576
--- /dev/null
+++ b/testing/web-platform/tests/fullscreen/api/document-fullscreen-enabled.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<title>Document.fullscreenEnabled</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<iframe></iframe>
+<iframe allowfullscreen></iframe>
+<script>
+test(function()
+{
+ assert_true(document.fullscreenEnabled, "top-level document");
+
+ var iframes = document.getElementsByTagName("iframe");
+ assert_false(iframes[0].contentDocument.fullscreenEnabled, "iframe without allowfullscreen");
+ assert_true(iframes[1].contentDocument.fullscreenEnabled, "iframe with allowfullscreen");
+});
+</script>
diff --git a/testing/web-platform/tests/fullscreen/api/document-onfullscreenchange-manual.html b/testing/web-platform/tests/fullscreen/api/document-onfullscreenchange-manual.html
new file mode 100644
index 000000000..d77872ffb
--- /dev/null
+++ b/testing/web-platform/tests/fullscreen/api/document-onfullscreenchange-manual.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<title>Document.onfullscreenchange</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../trusted-click.js"></script>
+<div id="log"></div>
+<script>
+async_test(function(t)
+{
+ var div = document.querySelector("div");
+ assert_equals(document.onfullscreenchange, null, "initial onfullscreenchange");
+ document.onfullscreenchange = t.step_func_done();
+ trusted_request(div);
+});
+</script>
diff --git a/testing/web-platform/tests/fullscreen/api/document-onfullscreenerror.html b/testing/web-platform/tests/fullscreen/api/document-onfullscreenerror.html
new file mode 100644
index 000000000..f5eaaf441
--- /dev/null
+++ b/testing/web-platform/tests/fullscreen/api/document-onfullscreenerror.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<title>Document.onfullscreenerror</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+async_test(function(t)
+{
+ assert_equals(document.onfullscreenerror, null, "initial onfullscreenerror");
+ document.onfullscreenerror = t.step_func_done();
+ document.createElement("a").requestFullscreen();
+});
+</script>
diff --git a/testing/web-platform/tests/fullscreen/api/element-ready-check-containing-iframe-manual.html b/testing/web-platform/tests/fullscreen/api/element-ready-check-containing-iframe-manual.html
new file mode 100644
index 000000000..a630fe2e8
--- /dev/null
+++ b/testing/web-platform/tests/fullscreen/api/element-ready-check-containing-iframe-manual.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<title>Element ready check for containing 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>
+<iframe allowfullscreen></iframe>
+<script>
+async_test(function(t)
+{
+ var iframes = document.getElementsByTagName("iframe");
+ trusted_request(iframes[0].contentDocument.body, document.body);
+ iframes[0].contentDocument.onfullscreenchange = t.step_func(function()
+ {
+ trusted_request(iframes[1].contentDocument.body, iframes[0].contentDocument.body);
+ iframes[1].contentDocument.onfullscreenchange = t.unreached_func("fullscreenchange event");
+ iframes[1].contentDocument.onfullscreenerror = t.step_func_done();
+ });
+});
+</script>
diff --git a/testing/web-platform/tests/fullscreen/api/element-ready-check-enabled-flag-not-set-manual.html b/testing/web-platform/tests/fullscreen/api/element-ready-check-enabled-flag-not-set-manual.html
new file mode 100644
index 000000000..501767dd6
--- /dev/null
+++ b/testing/web-platform/tests/fullscreen/api/element-ready-check-enabled-flag-not-set-manual.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<title>Element ready check with enabled flag not set</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../trusted-click.js"></script>
+<div id="log"></div>
+<iframe></iframe>
+<script>
+async_test(function(t)
+{
+ var iframe = document.querySelector("iframe");
+ document.onfullscreenchange = t.unreached_func("document fullscreenchange event");
+ document.onfullscreenerror = t.unreached_func("document fullscreenerror event");
+ iframe.contentDocument.onfullscreenchange = t.unreached_func("iframe fullscreenchange event");
+ iframe.contentDocument.onfullscreenerror = t.step_func_done();
+ assert_false(iframe.contentDocument.fullscreenEnabled, "fullscreen enabled flag");
+ trusted_request(iframe.contentDocument.body, document.body);
+});
+</script>
diff --git a/testing/web-platform/tests/fullscreen/api/element-ready-check-fullscreen-element-sibling-manual.html b/testing/web-platform/tests/fullscreen/api/element-ready-check-fullscreen-element-sibling-manual.html
new file mode 100644
index 000000000..82672cbfd
--- /dev/null
+++ b/testing/web-platform/tests/fullscreen/api/element-ready-check-fullscreen-element-sibling-manual.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<title>Element ready check for sibling of fullscreen element</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../trusted-click.js"></script>
+<div id="log"></div>
+<div id="a"></div>
+<div id="b"></div>
+<script>
+async_test(function(t)
+{
+ var a = document.getElementById("a");
+ var b = document.getElementById("b");
+ document.onfullscreenchange = t.step_func(function()
+ {
+ assert_equals(document.fullscreenElement, a, "fullscreen element");
+ trusted_request(b, a);
+ document.onfullscreenchange = t.unreached_func("second fullscreenchange event");
+ document.onfullscreenerror = t.step_func_done();
+ });
+ trusted_request(a);
+});
+</script>
diff --git a/testing/web-platform/tests/fullscreen/api/element-ready-check-fullscreen-iframe-child-manual.html b/testing/web-platform/tests/fullscreen/api/element-ready-check-fullscreen-iframe-child-manual.html
new file mode 100644
index 000000000..598fcfecf
--- /dev/null
+++ b/testing/web-platform/tests/fullscreen/api/element-ready-check-fullscreen-iframe-child-manual.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<title>Element ready check for child of a fullscreen 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><!-- script inserts div here --></iframe>
+<script>
+// Verify that an iframe can itself go fullscreen, and that this doesn't
+// influence the iframe ancestor test of the element ready check.
+async_test(function(t)
+{
+ var iframe = document.querySelector("iframe");
+ document.onfullscreenchange = t.step_func(function()
+ {
+ assert_equals(document.fullscreenElement, iframe, "fullscreen element");
+ var div = document.createElement("div");
+ // This adds the div to the iframe element itself, not to the iframe's
+ // contentDocument. It's done here because the HTML parser treats the
+ // content of iframe as a text node.
+ iframe.appendChild(div);
+ trusted_request(div, iframe.contentDocument.body);
+ document.onfullscreenchange = t.unreached_func("second fullscreenchange event");
+ document.onfullscreenerror = t.step_func_done();
+ });
+ trusted_request(iframe);
+});
+</script>
diff --git a/testing/web-platform/tests/fullscreen/api/element-ready-check-iframe-child-manual.html b/testing/web-platform/tests/fullscreen/api/element-ready-check-iframe-child-manual.html
new file mode 100644
index 000000000..0c1dd29a1
--- /dev/null
+++ b/testing/web-platform/tests/fullscreen/api/element-ready-check-iframe-child-manual.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<title>Element ready check for child of 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><!-- script inserts child here --></iframe>
+<script>
+async_test(function(t)
+{
+ var div = document.createElement("div");
+ document.querySelector("iframe").appendChild(div);
+ document.onfullscreenchange = t.unreached_func("fullscreenchange event");
+ document.onfullscreenerror = t.step_func_done();
+ trusted_request(div, document.body);
+});
+</script>
diff --git a/testing/web-platform/tests/fullscreen/api/element-ready-check-not-in-document-manual.html b/testing/web-platform/tests/fullscreen/api/element-ready-check-not-in-document-manual.html
new file mode 100644
index 000000000..904d31990
--- /dev/null
+++ b/testing/web-platform/tests/fullscreen/api/element-ready-check-not-in-document-manual.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<title>Element ready check for element not in a document</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../trusted-click.js"></script>
+<div id="log"></div>
+<script>
+async_test(function(t)
+{
+ var div = document.createElement("div");
+ document.onfullscreenchange = t.unreached_func("fullscreenchange event");
+ document.onfullscreenerror = t.step_func_done();
+ trusted_request(div, document.body);
+});
+</script>
diff --git a/testing/web-platform/tests/fullscreen/api/element-request-fullscreen-manual.html b/testing/web-platform/tests/fullscreen/api/element-request-fullscreen-manual.html
new file mode 100644
index 000000000..81bd6a05e
--- /dev/null
+++ b/testing/web-platform/tests/fullscreen/api/element-request-fullscreen-manual.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<title>Element.requestFullscreen()</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../trusted-click.js"></script>
+<div id="log"></div>
+<script>
+async_test(function(t)
+{
+ var div = document.querySelector("div");
+
+ document.addEventListener("fullscreenchange", t.step_func(function(event)
+ {
+ assert_equals(event.target, document, "event.target");
+ assert_false(event.bubbles, "event.bubbles");
+ assert_false(event.cancelable, "event.cancelable");
+ t.done();
+ }));
+
+ trusted_request(div);
+});
+</script>
diff --git a/testing/web-platform/tests/fullscreen/api/element-request-fullscreen-non-top-manual.html b/testing/web-platform/tests/fullscreen/api/element-request-fullscreen-non-top-manual.html
new file mode 100644
index 000000000..88eff090a
--- /dev/null
+++ b/testing/web-platform/tests/fullscreen/api/element-request-fullscreen-non-top-manual.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<title>Element.requestFullscreen() for non-top element in fullscreen element stack</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../trusted-click.js"></script>
+<div id="log"></div>
+<div id="first">
+ <div id="last"></div>
+</div>
+<script>
+async_test(function(t)
+{
+ var first = document.getElementById("first");
+ trusted_request(first);
+ document.onfullscreenchange = t.step_func(function()
+ {
+ assert_equals(document.fullscreenElement, first);
+ var last = document.getElementById("last");
+ trusted_request(last);
+ document.onfullscreenchange = t.step_func(function()
+ {
+ assert_equals(document.fullscreenElement, last);
+ trusted_request(first, last);
+ document.onfullscreenerror = t.step_func_done();
+ });
+ });
+});
+</script>
diff --git a/testing/web-platform/tests/fullscreen/api/element-request-fullscreen-svg-rect-manual.html b/testing/web-platform/tests/fullscreen/api/element-request-fullscreen-svg-rect-manual.html
new file mode 100644
index 000000000..5661bfef7
--- /dev/null
+++ b/testing/web-platform/tests/fullscreen/api/element-request-fullscreen-svg-rect-manual.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<title>Element.requestFullscreen() for SVG rect element</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../trusted-click.js"></script>
+<div id="log"></div>
+<svg><rect/></svg>
+<script>
+async_test(function(t)
+{
+ var rect = document.querySelector("rect");
+ assert_true(rect instanceof SVGRectElement);
+ trusted_request(rect, document.body);
+ document.onfullscreenchange = t.unreached_func("fullscreenerror event");
+ document.onfullscreenerror = t.step_func_done();
+});
+</script>
diff --git a/testing/web-platform/tests/fullscreen/api/element-request-fullscreen-svg-svg-manual.html b/testing/web-platform/tests/fullscreen/api/element-request-fullscreen-svg-svg-manual.html
new file mode 100644
index 000000000..553785d29
--- /dev/null
+++ b/testing/web-platform/tests/fullscreen/api/element-request-fullscreen-svg-svg-manual.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<title>Element.requestFullscreen() for SVG svg element</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../trusted-click.js"></script>
+<div id="log"></div>
+<svg></svg>
+<script>
+async_test(function(t)
+{
+ var svg = document.querySelector("svg");
+ assert_true(svg instanceof SVGSVGElement);
+ trusted_request(svg, document.body);
+ document.onfullscreenchange = t.step_func_done();
+ document.onfullscreenerror = t.unreached_func("fullscreenerror event");
+});
+</script>
diff --git a/testing/web-platform/tests/fullscreen/api/element-request-fullscreen-top-manual.html b/testing/web-platform/tests/fullscreen/api/element-request-fullscreen-top-manual.html
new file mode 100644
index 000000000..361834440
--- /dev/null
+++ b/testing/web-platform/tests/fullscreen/api/element-request-fullscreen-top-manual.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<title>Element.requestFullscreen() for top element in fullscreen element stack</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../trusted-click.js"></script>
+<div id="log"></div>
+<div id="top"></div>
+<script>
+async_test(function(t)
+{
+ var top = document.getElementById("top");
+ trusted_request(top);
+ document.onfullscreenchange = t.step_func(function()
+ {
+ assert_equals(document.fullscreenElement, top);
+ document.onfullscreenchange = t.unreached_func("fullscreenchange event");
+ trusted_click(t.step_func(function()
+ {
+ top.requestFullscreen();
+ // A fullscreenerror event would be fired after an async section
+ // and an animation frame task, so wait until after that.
+ t.step_timeout(function()
+ {
+ requestAnimationFrame(t.step_func_done());
+ }, 0);
+ }), top);
+ });
+ document.onfullscreenerror = t.unreached_func("fullscreenerror event");
+});
+</script>
diff --git a/testing/web-platform/tests/fullscreen/model/remove-child-manual.html b/testing/web-platform/tests/fullscreen/model/remove-child-manual.html
new file mode 100644
index 000000000..63cc727fb
--- /dev/null
+++ b/testing/web-platform/tests/fullscreen/model/remove-child-manual.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<title>Remove the child of the fullscreen element</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../trusted-click.js"></script>
+<div id="log"></div>
+<div id="parent">
+ <div></div>
+</div>
+<script>
+async_test(function(t)
+{
+ var parent = document.getElementById("parent");
+ trusted_request(parent);
+ document.onfullscreenchange = t.step_func(function()
+ {
+ assert_equals(document.fullscreenElement, parent);
+ parent.textContent = ""; // removes all children
+ document.onfullscreenchange = t.unreached_func("fullscreenchange event");
+ // A fullscreenchange event would be fired after an async section
+ // and an animation frame task, so wait until after that.
+ t.step_timeout(function()
+ {
+ requestAnimationFrame(t.step_func_done());
+ }, 0);
+ });
+});
+</script>
diff --git a/testing/web-platform/tests/fullscreen/model/remove-first-manual.html b/testing/web-platform/tests/fullscreen/model/remove-first-manual.html
new file mode 100644
index 000000000..5873a1cfc
--- /dev/null
+++ b/testing/web-platform/tests/fullscreen/model/remove-first-manual.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<title>Remove the first element on the fullscreen element stack</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../trusted-click.js"></script>
+<div id="log"></div>
+<div id="first">
+ <div id="last"></div>
+</div>
+<script>
+async_test(function(t)
+{
+ var first = document.getElementById("first");
+ trusted_request(first);
+ document.onfullscreenchange = t.step_func(function()
+ {
+ assert_equals(document.fullscreenElement, first);
+ var last = document.getElementById("last");
+ trusted_request(last);
+ document.onfullscreenchange = t.step_func(function()
+ {
+ assert_equals(document.fullscreenElement, last);
+ first.remove();
+ document.onfullscreenchange = t.step_func(function()
+ {
+ assert_equals(document.fullscreenElement, null);
+ t.done();
+ });
+ });
+ });
+});
+</script>
diff --git a/testing/web-platform/tests/fullscreen/model/remove-last-manual.html b/testing/web-platform/tests/fullscreen/model/remove-last-manual.html
new file mode 100644
index 000000000..3e5204962
--- /dev/null
+++ b/testing/web-platform/tests/fullscreen/model/remove-last-manual.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<title>Remove the last element on the fullscreen element stack</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../trusted-click.js"></script>
+<div id="log"></div>
+<div id="first">
+ <div id="last"></div>
+</div>
+<script>
+async_test(function(t)
+{
+ var first = document.getElementById("first");
+ trusted_request(first);
+ document.onfullscreenchange = t.step_func(function()
+ {
+ assert_equals(document.fullscreenElement, first);
+ var last = document.getElementById("last");
+ trusted_request(last);
+ document.onfullscreenchange = t.step_func(function()
+ {
+ assert_equals(document.fullscreenElement, last);
+ last.remove();
+ document.onfullscreenchange = t.step_func(function()
+ {
+ assert_equals(document.fullscreenElement, first);
+ t.done();
+ });
+ });
+ });
+});
+</script>
diff --git a/testing/web-platform/tests/fullscreen/model/remove-parent-manual.html b/testing/web-platform/tests/fullscreen/model/remove-parent-manual.html
new file mode 100644
index 000000000..74327637e
--- /dev/null
+++ b/testing/web-platform/tests/fullscreen/model/remove-parent-manual.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<title>Remove the parent of the fullscreen element</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../trusted-click.js"></script>
+<div id="log"></div>
+<div>
+ <div id="child"></div>
+</div>
+<script>
+async_test(function(t)
+{
+ var child = document.getElementById("child");
+ trusted_request(child);
+ document.onfullscreenchange = t.step_func(function()
+ {
+ assert_equals(document.fullscreenElement, child);
+ child.parentNode.remove();
+ document.onfullscreenchange = t.step_func(function()
+ {
+ assert_equals(document.fullscreenElement, null);
+ t.done();
+ });
+ });
+});
+</script>
diff --git a/testing/web-platform/tests/fullscreen/model/remove-single-manual.html b/testing/web-platform/tests/fullscreen/model/remove-single-manual.html
new file mode 100644
index 000000000..53abb5e82
--- /dev/null
+++ b/testing/web-platform/tests/fullscreen/model/remove-single-manual.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<title>Remove the single element on the fullscreen element stack</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../trusted-click.js"></script>
+<div id="log"></div>
+<div id="single"></div>
+<script>
+async_test(function(t)
+{
+ var single = document.getElementById("single");
+ document.onfullscreenchange = t.step_func(function()
+ {
+ assert_equals(document.fullscreenElement, single);
+ single.remove();
+ document.onfullscreenchange = t.step_func(function()
+ {
+ assert_equals(document.fullscreenElement, null);
+ t.done();
+ });
+ });
+ trusted_request(single);
+});
+</script>
diff --git a/testing/web-platform/tests/fullscreen/trusted-click.js b/testing/web-platform/tests/fullscreen/trusted-click.js
new file mode 100644
index 000000000..6cd4020f6
--- /dev/null
+++ b/testing/web-platform/tests/fullscreen/trusted-click.js
@@ -0,0 +1,24 @@
+// Invokes callback from a trusted click event, to satisfy
+// https://html.spec.whatwg.org/#triggered-by-user-activation
+function trusted_click(callback, container)
+{
+ var document = container.ownerDocument;
+ var button = document.createElement("button");
+ button.textContent = "click to continue test";
+ button.style.display = "block";
+ button.style.fontSize = "20px";
+ button.style.padding = "10px";
+ button.onclick = function()
+ {
+ callback();
+ container.removeChild(button);
+ };
+ container.appendChild(button);
+}
+
+// Invokes element.requestFullscreen() from a trusted click.
+function trusted_request(element, container)
+{
+ var request = element.requestFullscreen.bind(element);
+ trusted_click(request, container || element.parentNode);
+}