Simulate user inputs in css/selectors/focus-visible-003.html

Use testdriver Action API to simulate mouse click actions in
css/selectors/focus-visible-003.html.

Bug: 1145677
Change-Id: I18d3862d524c0a917c056891e7012c589b8252e2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2548197
Reviewed-by: Mustaq Ahmed <mustaq@chromium.org>
Commit-Queue: Lan Wei <lanwei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833502}
diff --git a/css/selectors/focus-visible-003-manual.html b/css/selectors/focus-visible-003.html
similarity index 89%
rename from css/selectors/focus-visible-003-manual.html
rename to css/selectors/focus-visible-003.html
index ccc916a..4620c1e 100644
--- a/css/selectors/focus-visible-003-manual.html
+++ b/css/selectors/focus-visible-003.html
@@ -7,6 +7,9 @@
   <link rel="help" href="https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo" />
   <script src="/resources/testharness.js"></script>
   <script src="/resources/testharnessreport.js"></script>
+  <script src="/resources/testdriver.js"></script>
+  <script src="/resources/testdriver-actions.js"></script>
+  <script src="/resources/testdriver-vendor.js"></script>
   <style>
     :focus-visible {
       outline: red dotted 1px; /* fallback for Edge */
@@ -40,7 +43,7 @@
     <button data-tested="false" id="el-4">Focus me</span>
   </div>
   <div>
-    <input data-tested="false" id="el-5" type="button" value="Focus me"</input>
+    <input data-tested="false" id="el-5" type="button" value="Focus me"></input>
   </div>
   <div>
     <input data-tested="false" id="el-6" type="image" alt="Focus me."></input>
@@ -69,6 +72,11 @@
     <label><input data-tested="false" id="el-11" type="color"></input> Focus me.</label>
   </div>
   <script>
+    function mouseClickInTarget(selector) {
+       let target = document.querySelector(selector);
+       return test_driver.click(target);
+    }
+
     async_test(function(t) {
         document.querySelectorAll("[data-tested]").forEach((el) => {
             el.addEventListener("click", t.step_func((e) => {
@@ -82,6 +90,8 @@
                 }
             }));
         });
+
+        mouseClickInTarget("[data-tested=false]");
     }, "Mouse focus on input elements which do not show a virtual keyboard should NOT match :focus-visible");
   </script>
 </body>