Skip to content

Commit

Permalink
Bug 1739634 [wpt PR 31521] - Add a WPT for pointerevent user activati…
Browse files Browse the repository at this point in the history
…on trigger., a=testonly

Automatic update from web-platform-tests
Add a WPT for pointerevent user activation trigger.

Related to HTML issue: whatwg/html#3849

Also fix double-activation in Chrome's gesture tap.

Bug: 826293, 1265587
Change-Id: I3bc3bcbcfeda242512fb777a1c8881c475fed5fc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3254213
Reviewed-by: Robert Flack <flackr@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Mustaq Ahmed <mustaq@chromium.org>
Cr-Commit-Position: refs/heads/main@{#940118}

--

wpt-commits: aa2fc4c2ddfac8b0870c0b075899478c9cabc0c2
wpt-pr: 31521
  • Loading branch information
mustaqahmed authored and moz-wptsync-bot committed Nov 15, 2021
1 parent 3963907 commit 7c32438
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ <h1>Test for right-click activation trigger</h1>
<script>
promise_test(async () => {
var actions = new test_driver.Actions();
actions_promise = actions
.pointerMove(0, 0, {origin: document.body})
actions.pointerMove(0, 0, {origin: document.body})
.pointerDown({button: actions.ButtonType.RIGHT})
.pointerUp({button: actions.ButtonType.RIGHT})
.send();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<!DOCTYPE html>
<html>
<head>
<meta name="variant" content="?mouse">
<meta name="variant" content="?pen">
<meta name="variant" content="?touch">
<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 pointerevent click activation trigger</h1>
<p>Tests user activation from a pointer click.</p>
<ol id="instructions">
<li>Click anywhere in the document.
</ol>
<script>
let pointer_type = location.search.substring(1);

promise_test(async () => {
const test_pointer = pointer_type + "TestPointer";

new test_driver.Actions().addPointer(test_pointer, pointer_type)
.pointerMove(0, 0, {origin:document.body, sourceName:test_pointer})
.pointerDown({sourceName:test_pointer})
.pointerUp({sourceName:test_pointer})
.send();

let pointerdown_event = getEvent('pointerdown');
let pointerup_event = getEvent('pointerup');
let click_event = getEvent('click');

await pointerdown_event;
let consumed_pointerdown = await consumeTransientActivation();
await pointerup_event;
let consumed_pointerup = await consumeTransientActivation();
await click_event;
let consumed_click = await consumeTransientActivation();

if (pointer_type === "mouse") {
assert_true(consumed_pointerdown,
pointer_type + " pointerdown event should result in activation");
assert_false(consumed_pointerup,
pointer_type + " pointerup should have no activation after pointerdown consumption");
assert_false(consumed_click,
pointer_type + " click should have no activation after pointerdown consumption");
} else {
assert_false(consumed_pointerdown,
pointer_type + " pointerdown event should not result in activation");
assert_true(consumed_pointerup,
pointer_type + " pointerup event should result in activation");
assert_false(consumed_click,
pointer_type + " click should have no activation after pointerup consumption");
}
}, "Activation through " + pointer_type + " pointerevent click");
</script>
</body>
</html>

0 comments on commit 7c32438

Please sign in to comment.