Add a wpt for UAv2 frame hierarchy check.

The test passes manually.

Bug: 978620
Change-Id: Ic40cef889d41c8b21e8e184d158ecdd2b92ebabd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1677067
Reviewed-by: Navid Zolghadr <nzolghadr@chromium.org>
Commit-Queue: Mustaq Ahmed <mustaq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#672503}
diff --git a/html/user-activation/activation-hierarchy-parent-manual.sub.tentative.html b/html/user-activation/activation-hierarchy-parent-manual.sub.tentative.html
new file mode 100644
index 0000000..7dd8018
--- /dev/null
+++ b/html/user-activation/activation-hierarchy-parent-manual.sub.tentative.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<!--
+   Tentative due to:
+   https://github.com/whatwg/html/issues/1903
+-->
+<html>
+<head>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resources/testdriver.js"></script>
+<script src="/resources/testdriver-vendor.js"></script>
+</head>
+<body>
+  <h1>Activation state is visible in parent and not in child</h1>
+  <ol id="instructions">
+    <li>Click anywhere on the green area (child frame).
+  </ol>
+  <iframe id="child" width="400" height="400"></iframe>
+  <script>
+    async_test(function(t) {
+        assert_false(navigator.userActivation.isActive);
+        assert_false(navigator.userActivation.hasBeenActive);
+
+        let child = document.getElementById("child");
+
+        window.addEventListener("message", t.step_func(event => {
+            if (event.source === frames[0].frames[0] && event.data === 'checked') {
+                // Parent should be active after child is clicked.
+                assert_true(navigator.userActivation.isActive);
+                assert_true(navigator.userActivation.hasBeenActive);
+                t.done();
+            }
+        }));
+        child.src = "http://{{domains[www1]}}:{{ports[http][0]}}/html/user-activation/resources/activation-hierarchy-child.sub.html";
+    }, "Parent test");
+  </script>
+</body>
+</html>
diff --git a/html/user-activation/resources/activation-hierarchy-child.sub.html b/html/user-activation/resources/activation-hierarchy-child.sub.html
new file mode 100644
index 0000000..ebccc8c
--- /dev/null
+++ b/html/user-activation/resources/activation-hierarchy-child.sub.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body style="background: lightgreen;">
+  <h1>Child frame</h1>
+  <iframe id="grandchild" width="350" height="200"></iframe>
+  <script>
+    async_test(function(t) {
+        assert_false(navigator.userActivation.isActive);
+        assert_false(navigator.userActivation.hasBeenActive);
+
+        var grandchild = document.getElementById("grandchild");
+
+        window.addEventListener("click", t.step_func(event => {
+            // Child should be active when clicked.
+            assert_true(navigator.userActivation.isActive);
+            assert_true(navigator.userActivation.hasBeenActive);
+
+            // Ask grandchild to check its state (and notify top frame).
+            grandchild.contentWindow.postMessage('check-request', '*');
+
+            t.done();
+        }));
+
+        grandchild.src = "http://{{domains[www2]}}:{{ports[http][0]}}/html/user-activation/resources/activation-hierarchy-grandchild.html";
+    }, "Child test");
+  </script>
+</body>
+</html>
diff --git a/html/user-activation/resources/activation-hierarchy-grandchild.html b/html/user-activation/resources/activation-hierarchy-grandchild.html
new file mode 100644
index 0000000..b9fe19a
--- /dev/null
+++ b/html/user-activation/resources/activation-hierarchy-grandchild.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<head>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body style="background: lightgrey;">
+  <h1>Grandchild frame</h1>
+  <script>
+    async_test(function(t) {
+        assert_false(navigator.userActivation.isActive);
+        assert_false(navigator.userActivation.hasBeenActive);
+
+        window.addEventListener("message", event => {
+            if (event.source === parent && event.data === 'check-request') {
+                // Grandchild shouldn't be active after child is clicked.
+                assert_false(navigator.userActivation.isActive);
+                assert_false(navigator.userActivation.hasBeenActive);
+
+                // Notify top frame that checks are done.
+                parent.parent.postMessage('checked', '*');
+
+                t.done();
+            }
+        });
+
+    }, "Grandchild test");
+  </script>
+</body>