Skip to content

Commit c948cbb

Browse files
LanWei22chromium-wpt-export-bot
authored andcommitted
Simulate user inputs in user-activation/no-activation-thru-escape-key.html
Use testdriver Action API to simulate mouse actions in html/user-activation/no-activation-thru-escape-key.html. Bug: 1145677 Change-Id: Id37bbe39be94b096939fe81d0c8053306accecb3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2537132 Reviewed-by: Mustaq Ahmed <[email protected]> Commit-Queue: Lan Wei <[email protected]> Cr-Commit-Position: refs/heads/master@{#828330}
1 parent 62b6255 commit c948cbb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

html/user-activation/no-activation-thru-escape-key-manual.html renamed to html/user-activation/no-activation-thru-escape-key.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
<link rel="help" href="https://html.spec.whatwg.org/#triggered-by-user-activation">
99
<script src="/resources/testharness.js"></script>
1010
<script src="/resources/testharnessreport.js"></script>
11+
<script src="/resources/testdriver.js"></script>
12+
<script src="/resources/testdriver-vendor.js"></script>
1113
<style>
1214
#target {
1315
width: 40ex;
@@ -16,6 +18,7 @@
1618
</style>
1719
<script type="text/javascript">
1820
let keydown_event_fired = false;
21+
let keyup_event_fired = false;
1922

2023
function run() {
2124
let textbox_elem = document.getElementById("target");
@@ -36,9 +39,19 @@
3639

3740
on_event(textbox_elem, "keyup", () => {
3841
test_esc_key.step(() => {
42+
if (keydown_event_fired)
43+
keyup_event_fired = true;
3944
assert_true(keydown_event_fired, "keydown event fired before keyup");
4045
assert_false(navigator.userActivation.isActive, "No user activation on keyup");
4146
});
47+
});
48+
49+
// Inject mouse inputs.
50+
const escape_key = "\uE00C";
51+
test_driver
52+
.send_keys(textbox_elem, escape_key)
53+
.then(() => {
54+
assert_true(keyup_event_fired, "keydown event fired before keyup");
4255
test_esc_key.done();
4356
});
4457
}

0 commit comments

Comments
 (0)