-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fine-tune wpts for user-activation triggers to match spec proposal.
Proposed HTML PR: whatwg/html#7248 Manually verified that these tests pass in Firefox. Change-Id: I910158680a3741290ba9beef2c29050c11763be0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3242442 Commit-Queue: Mustaq Ahmed <[email protected]> Reviewed-by: Domenic Denicola <[email protected]> Cr-Commit-Position: refs/heads/main@{#934619} NOKEYCHECK=True GitOrigin-RevId: 344664adfe08ed7b2bd1a9efb29ffe15f94767d6
- Loading branch information
1 parent
247b5e6
commit 11a009c
Showing
6 changed files
with
149 additions
and
108 deletions.
There are no files selected for viewing
77 changes: 0 additions & 77 deletions
77
blink/web_tests/external/wpt/html/user-activation/activation-thru-contextmenu-event.html
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
blink/web_tests/external/wpt/html/user-activation/activation-trigger-click.html
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
blink/web_tests/external/wpt/html/user-activation/activation-trigger-keyboard-escape.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!DOCTYPE html> | ||
<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> | ||
<script src="resources/utils.js"></script> | ||
</head> | ||
<body> | ||
<h1>Test for keyboard activation trigger for ESCAPE key</h1> | ||
<p>Tests missing user activation from a ESCAPE keyboard event.</p> | ||
<input type="text" autofocus /> | ||
<ol id="instructions"> | ||
<li>Press ESCAPE key. | ||
</ol> | ||
<script> | ||
promise_test(async () => { | ||
const ESCAPE_KEY = '\uE00C'; | ||
test_driver.send_keys(document.body, ESCAPE_KEY); | ||
|
||
let keydown_event = getEvent('keydown'); | ||
let keyup_event = getEvent('keyup'); | ||
|
||
await keydown_event; | ||
let consumed = await consumeTransientActivation(); | ||
assert_false(consumed, | ||
"ESCAPE keydown event should not result in activation"); | ||
|
||
await keyup_event; | ||
consumed = await consumeTransientActivation(); | ||
assert_false(consumed, | ||
"ESCAPE keyup should have no activation after keydown consumption"); | ||
}, "Activation through ESCAPE keyboard event"); | ||
</script> | ||
</body> | ||
</html> |
41 changes: 41 additions & 0 deletions
41
blink/web_tests/external/wpt/html/user-activation/activation-trigger-mouse-left.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!DOCTYPE html> | ||
<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> | ||
<script src="resources/utils.js"></script> | ||
</head> | ||
<body> | ||
<h1>Test for click activation trigger</h1> | ||
<p>Tests user activation from a mouse click.</p> | ||
<ol id="instructions"> | ||
<li>Click anywhere in the document. | ||
</ol> | ||
<script> | ||
promise_test(async () => { | ||
test_driver.click(document.body); | ||
|
||
let mousedown_event = getEvent('mousedown'); | ||
let mouseup_event = getEvent('mouseup'); | ||
let click_event = getEvent('click'); | ||
|
||
await mousedown_event; | ||
let consumed = await consumeTransientActivation(); | ||
assert_true(consumed, | ||
"mousedown event should result in activation"); | ||
|
||
await mouseup_event; | ||
consumed = await consumeTransientActivation(); | ||
assert_false(consumed, | ||
"mouseup should have no activation after mousedown consumption"); | ||
|
||
await click_event; | ||
consumed = await consumeTransientActivation(); | ||
assert_false(consumed, | ||
"click should have no activation after mousedown consumption"); | ||
}, "Activation through left-click mouse event"); | ||
</script> | ||
</body> | ||
</html> |
58 changes: 58 additions & 0 deletions
58
blink/web_tests/external/wpt/html/user-activation/activation-trigger-mouse-right.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<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> | ||
<script src="resources/utils.js"></script> | ||
</head> | ||
<body> | ||
<h1>Test for right-click activation trigger</h1> | ||
<p>Tests user activation from a mouse right-click.</p> | ||
<ol id="instructions"> | ||
<li>Right-click anywhere in the document. | ||
</ol> | ||
<script> | ||
promise_test(async () => { | ||
var actions = new test_driver.Actions(); | ||
actions_promise = actions | ||
.pointerMove(0, 0, {origin: document.body}) | ||
.pointerDown({button: actions.ButtonType.RIGHT}) | ||
.pointerUp({button: actions.ButtonType.RIGHT}) | ||
.send(); | ||
|
||
// In most non-Windows platforms the right-click context-menu appears on mousedown, so | ||
// mouseup and auxclick events are not received by the page if the menu is modal. We | ||
// are suppressing the context-menu to guarantee receiving those later events. | ||
document.body.addEventListener("contextmenu", e => e.preventDefault()); | ||
|
||
let mousedown_event = getEvent('mousedown'); | ||
let mouseup_event = getEvent('mouseup'); | ||
let auxclick_event = getEvent('auxclick'); | ||
let contextmenu_event = getEvent('contextmenu'); | ||
|
||
await mousedown_event; | ||
let consumed = await consumeTransientActivation(); | ||
assert_true(consumed, | ||
"mousedown event should result in activation"); | ||
|
||
await mouseup_event; | ||
consumed = await consumeTransientActivation(); | ||
assert_false(consumed, | ||
"mouseup should have no activation after mousedown consumption"); | ||
|
||
await auxclick_event; | ||
consumed = await consumeTransientActivation(); | ||
assert_false(consumed, | ||
"auxclick should have no activation after mousedown consumption"); | ||
|
||
await contextmenu_event; | ||
consumed = await consumeTransientActivation(); | ||
assert_false(consumed, | ||
"contextmenu should have no activation after mousedown consumption"); | ||
}, "Activation through right-click mouse event"); | ||
</script> | ||
</body> | ||
</html> |