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

Unified Diff: third_party/WebKit/LayoutTests/imported/wpt/html/semantics/embedded-content/the-iframe-element/iframe-allowfullscreen.html

Issue 1999243002: Import wpt@5df9b57edb3307a87d5187804b29c8ddd2aa14e1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add expectations files (using run-webkit-tests --new-baseline) Created 4 years, 7 months 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/imported/wpt/html/semantics/embedded-content/the-iframe-element/iframe-allowfullscreen.html
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/html/semantics/embedded-content/the-iframe-element/iframe-allowfullscreen.html b/third_party/WebKit/LayoutTests/imported/wpt/html/semantics/embedded-content/the-iframe-element/iframe-allowfullscreen.html
new file mode 100644
index 0000000000000000000000000000000000000000..316fb95c96c419863548a0dd8b67cde4b508611e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/wpt/html/semantics/embedded-content/the-iframe-element/iframe-allowfullscreen.html
@@ -0,0 +1,89 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Check how allowfullscreen affects fullscreen enabled flag</title>
+<link rel="author" title="Xidorn Quan" href="https://www.upsuper.org">
+<link rel="author" title="Mozilla" href="https://www.mozilla.org">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/browsers.html#initialise-the-document-object">
+<link rel="help" href="https://fullscreen.spec.whatwg.org/#fullscreen-enabled-flag">
+<script src="../../../../../../resources/testharness.js"></script>
+<script src="../../../../../../resources/testharnessreport.js"></script>
+
+<div id="log"></div>
+<script>
+ function test_allowfullscreen(t, setup_iframe) {
+ var iframe = document.createElement("iframe");
+ setup_iframe(iframe);
+ iframe.src = "support/blank.htm";
+ var eventWatcher = new EventWatcher(t, iframe, "load");
+ document.body.appendChild(iframe);
+ t.add_cleanup(function() {
+ document.body.removeChild(iframe);
+ });
+
+ assert_true(document.fullscreenEnabled, "Top level document has fullscreen enabled flag set");
+ eventWatcher.wait_for("load").then(t.step_func(function() {
+ assert_false(iframe.contentDocument.fullscreenEnabled, "Document inside iframe without allowfullscreen attribute should not have fullscreen enabled flag set");
+ iframe.setAttribute("allowfullscreen", true);
+ assert_false(iframe.contentDocument.fullscreenEnabled, "Setting allowfullscreen attribute after document load should not affect fullscreen enabled flag");
+ iframe.contentWindow.location.reload();
+ return eventWatcher.wait_for("load");
+ })).then(t.step_func(function() {
+ assert_true(iframe.contentDocument.fullscreenEnabled, "Fullscreen enabled flag should be set when a new document is loaded with allowfullscreen attribute present");
+ iframe.removeAttribute("allowfullscreen");
+ assert_true(iframe.contentDocument.fullscreenEnabled, "Removing allowfullscreen attribute should not affect fullscreen enabled flag");
+ iframe.contentWindow.location.reload();
+ return eventWatcher.wait_for("load");
+ })).then(t.step_func_done(function() {
+ assert_false(iframe.contentDocument.fullscreenEnabled, "Fullscreen enabled flag should be reset when a new document is loaded with allowfullscreen attribute absent");
+ }));
+ }
+
+ async_test(function(t) {
+ test_allowfullscreen(t, function(iframe) {});
+ }, "iframe-allowfullscreen");
+
+ async_test(function(t) {
+ test_allowfullscreen(t, function(iframe) {
+ iframe.setAttribute("sandbox", "allow-same-origin");
+ });
+ }, "iframe-sandbox-allowfullscreen");
+
+ function test_allowfullscreen_dialog(t, setup_iframe, check) {
+ var iframe = document.createElement("iframe");
+ setup_iframe(iframe);
+ iframe.src = "support/blank.htm";
+ var eventWatcher = new EventWatcher(t, iframe, "load");
+ document.body.appendChild(iframe);
+ t.add_cleanup(function() {
+ document.body.removeChild(iframe);
+ });
+
+ var newWin;
+ assert_true(document.fullscreenEnabled, "Top level document has fullscreen enabled flag set");
+ eventWatcher.wait_for("load").then(t.step_func(function() {
+ assert_false(iframe.contentDocument.fullscreenEnabled, "Document inside iframe without allowfullscreen attribute should not have fullscreen enabled flag set");
+ newWin = iframe.contentWindow.open("support/blank.htm");
+ t.add_cleanup(function() {
+ newWin.close();
+ });
+ var newWinEventWatcher = new EventWatcher(t, newWin, "load");
+ return newWinEventWatcher.wait_for("load");
+ })).then(t.step_func_done(function() {
+ check(newWin);
+ }));
+ }
+
+ async_test(function(t) {
+ test_allowfullscreen_dialog(t, function() {}, function(newWin) {
+ assert_true(newWin.document.fullscreenEnabled, "Document in the new window is a top level document, thus should has fullscreen enabled flag set");
+ });
+ }, "iframe-allowfullscreen-dialog");
+
+ async_test(function(t) {
+ test_allowfullscreen_dialog(t, function(iframe) {
+ iframe.setAttribute("sandbox", "allow-same-origin allow-popups");
+ }, function(newWin) {
+ assert_false(newWin.document.fullscreenEnabled, "Document in the new window should inherit the sandboxed fullscreen flag and should not have fullscreen enabled flag set");
+ });
+ }, "iframe-sandbox-allowfullscreen-dialog");
+</script>

Powered by Google App Engine
This is Rietveld 408576698