Bug 1458650 [wpt PR 10791] - Treat long-press gesture as a user activation., a=testonly draft
authorMustaq Ahmed <mustaq@google.com>
Thu, 03 May 2018 22:29:17 +0000
changeset 791493 4162f762e2a23faa47faf4763534c8dcd63e6054
parent 791492 c2630069cc3c1492ee7dc2c0b6f3e4c674a93530
child 791494 1fc09bf93e2e18752c3f70b668cf7c7dfadd619d
push id108825
push userbmo:james@hoppipolla.co.uk
push dateFri, 04 May 2018 14:12:31 +0000
reviewerstestonly
bugs1458650, 10791, 836401, 1039265, 555450
milestone61.0a1
Bug 1458650 [wpt PR 10791] - Treat long-press gesture as a user activation., a=testonly Automatic update from web-platform-testsTreat long-press gesture as a user activation. Also add a web-platform-test for this change, which is already supported by Firefox. Intent to ship: https://groups.google.com/a/chromium.org/d/msg/blink-dev/-2AyrUFwXvY/Q_wCUmKSAgAJ Spec change PR: https://github.com/whatwg/html/pull/3659 Bug: 836401 Change-Id: Ia710190857211684ce5ce7d4ff835b874f658b29 Reviewed-on: https://chromium-review.googlesource.com/1039265 Reviewed-by: Dave Tapuska <dtapuska@chromium.org> Commit-Queue: Mustaq Ahmed <mustaq@chromium.org> Cr-Commit-Position: refs/heads/master@{#555450} -- wpt-commits: d86d487f8c2b41816e01ecde2116252fbdf4de43 wpt-pr: 10791
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/html/user-activation/activation-thru-contextmenu-event-manual.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -14534,16 +14534,22 @@
     ]
    ],
    "html/semantics/selectors/pseudo-classes/checked-001-manual.html": [
     [
      "/html/semantics/selectors/pseudo-classes/checked-001-manual.html",
      {}
     ]
    ],
+   "html/user-activation/activation-thru-contextmenu-event-manual.html": [
+    [
+     "/html/user-activation/activation-thru-contextmenu-event-manual.html",
+     {}
+    ]
+   ],
    "html/webappapis/scripting/event-loops/task_microtask_ordering-manual.html": [
     [
      "/html/webappapis/scripting/event-loops/task_microtask_ordering-manual.html",
      {}
     ]
    ],
    "html/webappapis/scripting/events/contextmenu-event-manual.htm": [
     [
@@ -579483,16 +579489,20 @@
   "html/tools/html5lib_test_fragment.xml": [
    "99484d23f37fe2e9bd7fa57efffd4d22373aaeaa",
    "support"
   ],
   "html/tools/update_html5lib_tests.py": [
    "2bea14569ddd5c874a05d7ad72f083b2918d6e84",
    "support"
   ],
+  "html/user-activation/activation-thru-contextmenu-event-manual.html": [
+   "6383438f2069930b8f7fe684c5a2850d138e6073",
+   "manual"
+  ],
   "html/webappapis/.gitkeep": [
    "da39a3ee5e6b4b0d3255bfef95601890afd80709",
    "support"
   ],
   "html/webappapis/animation-frames/callback-exception.html": [
    "048a2861a33a79fdfa15d4cceedb90d16a75215d",
    "testharness"
   ],
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/user-activation/activation-thru-contextmenu-event-manual.html
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>User activation with 'contextmenu' event</title>
+    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
+    <link rel="author" title="Google" href="http://www.google.com "/>
+    <link rel="help" href="https://html.spec.whatwg.org/#triggered-by-user-activation">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <style>
+      #target {
+        width: 250px;
+        height: 150px;
+        float: left;
+        background-color: green;
+      }
+
+      #done {
+        float: left;
+        padding: 20px;
+        margin: 10px;
+      }
+    </style>
+    <script type="text/javascript">
+      let activation_event_fired = false;
+
+      function run() {
+        let success = false;
+        let test_contextmenu = async_test("'contextmenu' can call vibrate.");
+
+        on_event(document.getElementById("done"), "click", () => {
+          test_contextmenu.step(() => {
+            assert_true(activation_event_fired, "activation event has fired");
+          });
+          test_contextmenu.done();
+        });
+
+        on_event(document.getElementById("target"), "contextmenu", (e) => {
+            test_contextmenu.step(() => {
+              e.preventDefault();
+              assert_true(navigator.vibrate(200), "navigator.vibrate is successful");
+              activation_event_fired = true;
+            });
+        });
+      }
+    </script>
+  </head>
+  <body onload="run()">
+    <h1>User activation with 'contextmenu' event</h1>
+    <h4>Tests that a 'contextmenu' event is treated like a user activation.</h4>
+    <ol>
+      <li>Right-click or long-press on green.</li>
+      <li>Click or tap on Done.</li>
+    </ol>
+    <div id="target"></div>
+    <input type="button" id="done" value="Done" />
+  </body>
+</html>