Automate Fullscreen web-platform-tests using wpt_automation

BUG=660846

Review-Url: https://codereview.chromium.org/2466333002
Cr-Commit-Position: refs/heads/master@{#429118}
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations
index 99d65ba..df89275 100644
--- a/third_party/WebKit/LayoutTests/TestExpectations
+++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -1207,8 +1207,7 @@
 
 crbug.com/525296 fast/css/font-load-while-styleresolver-missing.html [ Crash Failure Pass ]
 
-crbug.com/240576 fullscreen/api/element-ready-check-containing-iframe.html [ Timeout Failure Pass ]
-crbug.com/240576 virtual/android/fullscreen/api/element-ready-check-containing-iframe.html [ Timeout Failure Pass ]
+crbug.com/240576 imported/wpt/fullscreen/api/element-ready-check-containing-iframe-manual.html [ Timeout Failure Pass ]
 
 crbug.com/567230 [ Debug ] virtual/threaded/animations/restart-not-visible.html [ Timeout ]
 
@@ -1515,23 +1514,3 @@
 
 crbug.com/657968 storage/indexeddb/idbdatabase-createObjectStore-exception-order.html [ Pass Failure ]
 crbug.com/657968 storage/indexeddb/idbdatabase-deleteObjectStore-exception-order.html [ Pass Failure ]
-
-crbug.com/660846 imported/wpt/fullscreen/api/document-exit-fullscreen-manual.html [ Skip ]
-crbug.com/660846 imported/wpt/fullscreen/api/document-fullscreen-element-manual.html [ Skip ]
-crbug.com/660846 imported/wpt/fullscreen/api/document-onfullscreenchange-manual.html [ Skip ]
-crbug.com/660846 imported/wpt/fullscreen/api/element-ready-check-containing-iframe-manual.html [ Skip ]
-crbug.com/660846 imported/wpt/fullscreen/api/element-ready-check-enabled-flag-not-set-manual.html [ Skip ]
-crbug.com/660846 imported/wpt/fullscreen/api/element-ready-check-fullscreen-element-sibling-manual.html [ Skip ]
-crbug.com/660846 imported/wpt/fullscreen/api/element-ready-check-fullscreen-iframe-child-manual.html [ Skip ]
-crbug.com/660846 imported/wpt/fullscreen/api/element-ready-check-iframe-child-manual.html [ Skip ]
-crbug.com/660846 imported/wpt/fullscreen/api/element-ready-check-not-in-document-manual.html [ Skip ]
-crbug.com/660846 imported/wpt/fullscreen/api/element-request-fullscreen-manual.html [ Skip ]
-crbug.com/660846 imported/wpt/fullscreen/api/element-request-fullscreen-non-top-manual.html [ Skip ]
-crbug.com/660846 imported/wpt/fullscreen/api/element-request-fullscreen-svg-rect-manual.html [ Skip ]
-crbug.com/660846 imported/wpt/fullscreen/api/element-request-fullscreen-svg-svg-manual.html [ Skip ]
-crbug.com/660846 imported/wpt/fullscreen/api/element-request-fullscreen-top-manual.html [ Skip ]
-crbug.com/660846 imported/wpt/fullscreen/model/remove-child-manual.html [ Skip ]
-crbug.com/660846 imported/wpt/fullscreen/model/remove-first-manual.html [ Skip ]
-crbug.com/660846 imported/wpt/fullscreen/model/remove-last-manual.html [ Skip ]
-crbug.com/660846 imported/wpt/fullscreen/model/remove-parent-manual.html [ Skip ]
-crbug.com/660846 imported/wpt/fullscreen/model/remove-single-manual.html [ Skip ]
diff --git a/third_party/WebKit/LayoutTests/fullscreen/api/document-exit-fullscreen.html b/third_party/WebKit/LayoutTests/fullscreen/api/document-exit-fullscreen.html
deleted file mode 100644
index 7c3692f..0000000
--- a/third_party/WebKit/LayoutTests/fullscreen/api/document-exit-fullscreen.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!DOCTYPE html>
-<title>Document.exitFullscreen()</title>
-<script src="../../resources/testharness.js"></script>
-<script src="../../resources/testharnessreport.js"></script>
-<script src="../trusted-event.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/third_party/WebKit/LayoutTests/fullscreen/api/document-fullscreen-element.html b/third_party/WebKit/LayoutTests/fullscreen/api/document-fullscreen-element.html
index 3e08e9a..03f11e5 100644
--- a/third_party/WebKit/LayoutTests/fullscreen/api/document-fullscreen-element.html
+++ b/third_party/WebKit/LayoutTests/fullscreen/api/document-fullscreen-element.html
@@ -13,7 +13,8 @@
     {
         assert_equals(document.fullscreenElement, div, "fullscreenElement before exitFullscreen()");
         document.exitFullscreen();
-        // FIXME: per spec fullscreenElement should still be div
+        // TODO(foolip): fullscreenElement should still be div.
+        // https://crbug.com/402421
         assert_equals(document.fullscreenElement, null, "fullscreenElement after exitFullscreen()");
 
         document.onfullscreenchange = t.step_func(function()
@@ -27,7 +28,8 @@
     {
         assert_equals(document.fullscreenElement, null, "fullscreenElement before requestFullscreen()");
         div.requestFullscreen();
-        // FIXME: per spec fullscreenElement should still be null
+        // TODO(foolip): fullscreenElement should still be null.
+        // https://crbug.com/402421
         assert_equals(document.fullscreenElement, div, "fullscreenElement after requestFullscreen()");
     }), document.body);
 });
diff --git a/third_party/WebKit/LayoutTests/fullscreen/api/document-onfullscreenchange.html b/third_party/WebKit/LayoutTests/fullscreen/api/document-onfullscreenchange.html
deleted file mode 100644
index e0837b0..0000000
--- a/third_party/WebKit/LayoutTests/fullscreen/api/document-onfullscreenchange.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!DOCTYPE html>
-<title>Document.onfullscreenchange</title>
-<script src="../../resources/testharness.js"></script>
-<script src="../../resources/testharnessreport.js"></script>
-<script src="../trusted-event.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/third_party/WebKit/LayoutTests/fullscreen/api/element-ready-check-containing-iframe.html b/third_party/WebKit/LayoutTests/fullscreen/api/element-ready-check-containing-iframe.html
deleted file mode 100644
index 5ff2dcd4..0000000
--- a/third_party/WebKit/LayoutTests/fullscreen/api/element-ready-check-containing-iframe.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<!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-event.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/third_party/WebKit/LayoutTests/fullscreen/api/element-ready-check-enabled-flag-not-set.html b/third_party/WebKit/LayoutTests/fullscreen/api/element-ready-check-enabled-flag-not-set.html
deleted file mode 100644
index 31a207e..0000000
--- a/third_party/WebKit/LayoutTests/fullscreen/api/element-ready-check-enabled-flag-not-set.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!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-event.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/third_party/WebKit/LayoutTests/fullscreen/api/element-ready-check-fullscreen-element-sibling.html b/third_party/WebKit/LayoutTests/fullscreen/api/element-ready-check-fullscreen-element-sibling.html
deleted file mode 100644
index 73966f4..0000000
--- a/third_party/WebKit/LayoutTests/fullscreen/api/element-ready-check-fullscreen-element-sibling.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!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-event.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);
-        document.onfullscreenchange = t.unreached_func("second fullscreenchange event");
-        document.onfullscreenerror = t.step_func_done();
-    });
-    trusted_request(a);
-});
-</script>
diff --git a/third_party/WebKit/LayoutTests/fullscreen/api/element-ready-check-fullscreen-iframe-child.html b/third_party/WebKit/LayoutTests/fullscreen/api/element-ready-check-fullscreen-iframe-child.html
deleted file mode 100644
index 0d7ab814..0000000
--- a/third_party/WebKit/LayoutTests/fullscreen/api/element-ready-check-fullscreen-iframe-child.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!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-event.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/third_party/WebKit/LayoutTests/fullscreen/api/element-ready-check-iframe-child.html b/third_party/WebKit/LayoutTests/fullscreen/api/element-ready-check-iframe-child.html
deleted file mode 100644
index 9ebed275..0000000
--- a/third_party/WebKit/LayoutTests/fullscreen/api/element-ready-check-iframe-child.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<!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-event.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/third_party/WebKit/LayoutTests/fullscreen/api/element-ready-check-not-in-document.html b/third_party/WebKit/LayoutTests/fullscreen/api/element-ready-check-not-in-document.html
deleted file mode 100644
index b8fd9a7d..0000000
--- a/third_party/WebKit/LayoutTests/fullscreen/api/element-ready-check-not-in-document.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!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-event.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/third_party/WebKit/LayoutTests/fullscreen/api/element-request-fullscreen-non-top.html b/third_party/WebKit/LayoutTests/fullscreen/api/element-request-fullscreen-non-top.html
deleted file mode 100644
index 3a5c657..0000000
--- a/third_party/WebKit/LayoutTests/fullscreen/api/element-request-fullscreen-non-top.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!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-event.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/third_party/WebKit/LayoutTests/fullscreen/api/element-request-fullscreen-top.html b/third_party/WebKit/LayoutTests/fullscreen/api/element-request-fullscreen-top.html
deleted file mode 100644
index 260b8631..0000000
--- a/third_party/WebKit/LayoutTests/fullscreen/api/element-request-fullscreen-top.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!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-event.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_event(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.
-            setTimeout(requestAnimationFrame.bind(null, t.step_func_done()), 0);
-        }), top);
-    });
-    document.onfullscreenerror = t.unreached_func("fullscreenerror event");
-});
-</script>
diff --git a/third_party/WebKit/LayoutTests/fullscreen/api/element-request-fullscreen.html b/third_party/WebKit/LayoutTests/fullscreen/api/element-request-fullscreen.html
deleted file mode 100644
index 6ef000d..0000000
--- a/third_party/WebKit/LayoutTests/fullscreen/api/element-request-fullscreen.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<!DOCTYPE html>
-<title>Element.requestFullscreen()</title>
-<script src="../../resources/testharness.js"></script>
-<script src="../../resources/testharnessreport.js"></script>
-<script src="../trusted-event.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/third_party/WebKit/LayoutTests/fullscreen/model/remove-child.html b/third_party/WebKit/LayoutTests/fullscreen/model/remove-child.html
deleted file mode 100644
index ba4a122..0000000
--- a/third_party/WebKit/LayoutTests/fullscreen/model/remove-child.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!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-event.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);
-        while (parent.firstChild) {
-            parent.firstChild.remove();
-        }
-        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.
-        setTimeout(requestAnimationFrame.bind(null, t.step_func_done()), 0);
-    });
-});
-</script>
diff --git a/third_party/WebKit/LayoutTests/fullscreen/model/remove-first.html b/third_party/WebKit/LayoutTests/fullscreen/model/remove-first.html
deleted file mode 100644
index 75458cb7..0000000
--- a/third_party/WebKit/LayoutTests/fullscreen/model/remove-first.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<!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-event.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/third_party/WebKit/LayoutTests/fullscreen/model/remove-last.html b/third_party/WebKit/LayoutTests/fullscreen/model/remove-last.html
deleted file mode 100644
index b7a3807..0000000
--- a/third_party/WebKit/LayoutTests/fullscreen/model/remove-last.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<!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-event.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/third_party/WebKit/LayoutTests/fullscreen/model/remove-parent.html b/third_party/WebKit/LayoutTests/fullscreen/model/remove-parent.html
deleted file mode 100644
index 540fae60..0000000
--- a/third_party/WebKit/LayoutTests/fullscreen/model/remove-parent.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<!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-event.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/third_party/WebKit/LayoutTests/fullscreen/model/remove-single.html b/third_party/WebKit/LayoutTests/fullscreen/model/remove-single.html
deleted file mode 100644
index 8c88adb3..0000000
--- a/third_party/WebKit/LayoutTests/fullscreen/model/remove-single.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!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-event.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/third_party/WebKit/LayoutTests/imported/wpt/fullscreen/api/document-fullscreen-element-manual-expected.txt b/third_party/WebKit/LayoutTests/imported/wpt/fullscreen/api/document-fullscreen-element-manual-expected.txt
new file mode 100644
index 0000000..9fc4770
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/wpt/fullscreen/api/document-fullscreen-element-manual-expected.txt
@@ -0,0 +1,4 @@
+This is a testharness.js-based test.
+FAIL Document.fullscreenElement assert_equals: fullscreenElement after requestFullscreen() expected null but got Element node <div id="log"></div>
+Harness: the test ran to completion.
+
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/fullscreen/api/element-request-fullscreen-svg-rect-manual-expected.txt b/third_party/WebKit/LayoutTests/imported/wpt/fullscreen/api/element-request-fullscreen-svg-rect-manual-expected.txt
new file mode 100644
index 0000000..1a7276a9
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/wpt/fullscreen/api/element-request-fullscreen-svg-rect-manual-expected.txt
@@ -0,0 +1,4 @@
+This is a testharness.js-based test.
+FAIL Element.requestFullscreen() for SVG rect element assert_unreached: fullscreenerror event Reached unreachable code
+Harness: the test ran to completion.
+
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/html/semantics/embedded-content/the-img-element/update-the-source-set-expected.txt b/third_party/WebKit/LayoutTests/imported/wpt/html/semantics/embedded-content/the-img-element/update-the-source-set-expected.txt
index 025f6cc9..2c39898 100644
--- a/third_party/WebKit/LayoutTests/imported/wpt/html/semantics/embedded-content/the-img-element/update-the-source-set-expected.txt
+++ b/third_party/WebKit/LayoutTests/imported/wpt/html/semantics/embedded-content/the-img-element/update-the-source-set-expected.txt
@@ -1,8 +1,8 @@
 CONSOLE WARNING: <source src> with a <picture> parent is invalid and therefore ignored. Please use <source srcset> instead.
 CONSOLE ERROR: Failed parsing 'srcset' attribute value since it has multiple 'x' descriptors or a mix of 'x' and 'w'/'h' descriptors.
 CONSOLE ERROR: Dropped srcset candidate "data:,b"
-CONSOLE ERROR: line 179: Failed parsing 'srcset' attribute value since it has multiple 'x' descriptors or a mix of 'x' and 'w'/'h' descriptors.
-CONSOLE ERROR: line 179: Dropped srcset candidate "data:,b"
+CONSOLE ERROR: line 187: Failed parsing 'srcset' attribute value since it has multiple 'x' descriptors or a mix of 'x' and 'w'/'h' descriptors.
+CONSOLE ERROR: line 187: Dropped srcset candidate "data:,b"
 This is a testharness.js-based test.
 PASS <img data-expect=""> 
 PASS <img src="" data-expect=""> 
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/resources/testharnessreport.js b/third_party/WebKit/LayoutTests/imported/wpt/resources/testharnessreport.js
index 11433b6..5a90ebc 100644
--- a/third_party/WebKit/LayoutTests/imported/wpt/resources/testharnessreport.js
+++ b/third_party/WebKit/LayoutTests/imported/wpt/resources/testharnessreport.js
@@ -79,37 +79,45 @@
         return !!document.querySelector('script[src*="/resources/testharness"]');
     }
 
+    function isWPTManualTest() {
+        var path = location.pathname;
+        return /\/imported\/wpt\/.*-manual\.html$/.test(path);
+    }
 
-    function injectSyntheticInput() {
-        var path = window.location.pathname;
-        if (path.match(/imported\/wpt\/.*\.html$/)) {
-            // Set a global variable for the address of automated input script if they need to use it.
-            var automated_input_scripts_folder = path.replace(/imported\/wpt\/(.*)\.html$/, 'imported/wpt_automation');
+    function loadAutomationScript() {
+        var testPath = location.pathname;
+        var automationPath = testPath.replace(/\/imported\/wpt\/.*$/, '/imported/wpt_automation');
 
-            importAutomationScript = function(relativePath) {
-              var common_script = document.createElement('script');
-              common_script.setAttribute('src', automated_input_scripts_folder + relativePath);
-              document.head.appendChild(common_script);
-            }
-
-            path = path.replace(/imported\/wpt\/(.*)\.html$/, "imported/wpt_automation/$1-automation.js");
-            var input_script = document.createElement('script');
-            input_script.setAttribute('src', path);
-            document.head.appendChild(input_script);
+        // Export importAutomationScript for use by the automation scripts.
+        window.importAutomationScript = function(relativePath) {
+            var script = document.createElement('script');
+            script.src = automationPath + relativePath;
+            document.head.appendChild(script);
         }
+
+        var src;
+        if (testPath.includes('/imported/wpt/fullscreen/')) {
+            // Fullscreen tests all use the same automation script.
+            src = automationPath + '/fullscreen/auto-click.js';
+        } else if (testPath.includes('/imported/wpt/pointerevents/')
+                   || testPath.includes('/imported/wpt/uievents/')) {
+            // Per-test automation scripts.
+            src = testPath.replace(/\/imported\/wpt\/(.*)\.html$/, "/imported/wpt_automation/$1-automation.js");
+        } else {
+            return;
+        }
+        var script = document.createElement('script');
+        script.src = src;
+        document.head.appendChild(script);
     }
 
     var didDispatchLoadEvent = false;
-    var handleLoad = function() {
+    window.addEventListener('load', function() {
         didDispatchLoadEvent = true;
-        window.removeEventListener('load', handleLoad);
-        // Add synthetic input to pointer event manual tests
-        if(window.location.pathname.includes('imported/wpt/pointerevents/')
-            || window.location.pathname.includes('imported/wpt/uievents/')) {
-            setTimeout(injectSyntheticInput, 0);
+        if (isWPTManualTest()) {
+            setTimeout(loadAutomationScript, 0);
         }
-    };
-    window.addEventListener('load', handleLoad, false);
+    }, { once: true });
 
     // Using a callback function, test results will be added to the page in a
     // manner that allows dumpAsText to produce readable test results.
diff --git a/third_party/WebKit/LayoutTests/imported/wpt_automation/fullscreen/auto-click.js b/third_party/WebKit/LayoutTests/imported/wpt_automation/fullscreen/auto-click.js
new file mode 100644
index 0000000..2c4723b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/wpt_automation/fullscreen/auto-click.js
@@ -0,0 +1,36 @@
+(function() {
+
+function click(button) {
+  var rect = button.getBoundingClientRect();
+  eventSender.mouseMoveTo(rect.left, rect.top);
+  eventSender.mouseDown();
+  eventSender.mouseUp();
+}
+
+var observer = new MutationObserver(mutations => {
+  for (var mutation of mutations) {
+    for (var node of mutation.addedNodes) {
+      if (node.localName == 'button')
+        click(node);
+      else if (node.localName == 'iframe')
+        observe(node.contentDocument);
+    }
+  }
+});
+
+function observe(target) {
+  observer.observe(target, { childList: true, subtree: true });
+}
+
+// Handle what's already in the document.
+for (var button of document.getElementsByTagName('button')) {
+  click(button);
+}
+for (var iframe of document.getElementsByTagName('iframe')) {
+  observe(iframe.contentDocument);
+}
+
+// Observe future changes.
+observe(document);
+
+})();
diff --git a/third_party/WebKit/LayoutTests/resources/testharnessreport.js b/third_party/WebKit/LayoutTests/resources/testharnessreport.js
index 11433b6..5a90ebc 100644
--- a/third_party/WebKit/LayoutTests/resources/testharnessreport.js
+++ b/third_party/WebKit/LayoutTests/resources/testharnessreport.js
@@ -79,37 +79,45 @@
         return !!document.querySelector('script[src*="/resources/testharness"]');
     }
 
+    function isWPTManualTest() {
+        var path = location.pathname;
+        return /\/imported\/wpt\/.*-manual\.html$/.test(path);
+    }
 
-    function injectSyntheticInput() {
-        var path = window.location.pathname;
-        if (path.match(/imported\/wpt\/.*\.html$/)) {
-            // Set a global variable for the address of automated input script if they need to use it.
-            var automated_input_scripts_folder = path.replace(/imported\/wpt\/(.*)\.html$/, 'imported/wpt_automation');
+    function loadAutomationScript() {
+        var testPath = location.pathname;
+        var automationPath = testPath.replace(/\/imported\/wpt\/.*$/, '/imported/wpt_automation');
 
-            importAutomationScript = function(relativePath) {
-              var common_script = document.createElement('script');
-              common_script.setAttribute('src', automated_input_scripts_folder + relativePath);
-              document.head.appendChild(common_script);
-            }
-
-            path = path.replace(/imported\/wpt\/(.*)\.html$/, "imported/wpt_automation/$1-automation.js");
-            var input_script = document.createElement('script');
-            input_script.setAttribute('src', path);
-            document.head.appendChild(input_script);
+        // Export importAutomationScript for use by the automation scripts.
+        window.importAutomationScript = function(relativePath) {
+            var script = document.createElement('script');
+            script.src = automationPath + relativePath;
+            document.head.appendChild(script);
         }
+
+        var src;
+        if (testPath.includes('/imported/wpt/fullscreen/')) {
+            // Fullscreen tests all use the same automation script.
+            src = automationPath + '/fullscreen/auto-click.js';
+        } else if (testPath.includes('/imported/wpt/pointerevents/')
+                   || testPath.includes('/imported/wpt/uievents/')) {
+            // Per-test automation scripts.
+            src = testPath.replace(/\/imported\/wpt\/(.*)\.html$/, "/imported/wpt_automation/$1-automation.js");
+        } else {
+            return;
+        }
+        var script = document.createElement('script');
+        script.src = src;
+        document.head.appendChild(script);
     }
 
     var didDispatchLoadEvent = false;
-    var handleLoad = function() {
+    window.addEventListener('load', function() {
         didDispatchLoadEvent = true;
-        window.removeEventListener('load', handleLoad);
-        // Add synthetic input to pointer event manual tests
-        if(window.location.pathname.includes('imported/wpt/pointerevents/')
-            || window.location.pathname.includes('imported/wpt/uievents/')) {
-            setTimeout(injectSyntheticInput, 0);
+        if (isWPTManualTest()) {
+            setTimeout(loadAutomationScript, 0);
         }
-    };
-    window.addEventListener('load', handleLoad, false);
+    }, { once: true });
 
     // Using a callback function, test results will be added to the page in a
     // manner that allows dumpAsText to produce readable test results.