Skip to content

Commit

Permalink
Add a WPT for pointerevent user activation trigger.
Browse files Browse the repository at this point in the history
Related to HTML issue: whatwg/html#3849

Bug: 826293
Change-Id: I9e4bc0df46df63e05dac64af32c1aab7cdabffe4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3282485
Commit-Queue: Mustaq Ahmed <mustaq@chromium.org>
Reviewed-by: Robert Flack <flackr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#942663}
NOKEYCHECK=True
GitOrigin-RevId: 5a60aab31ba136dae6cd61b0e48cb753929b1051
  • Loading branch information
mustaqahmed authored and Copybara-Service committed Nov 17, 2021
1 parent 97df40d commit ea9e04a
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 2 deletions.
2 changes: 2 additions & 0 deletions blink/web_tests/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -3331,6 +3331,8 @@ crbug.com/626703 external/wpt/css/css-grid/grid-model/grid-areas-overflowing-gri
crbug.com/626703 external/wpt/css/css-sizing/fit-content-length-percentage-002.html [ Failure ]
crbug.com/626703 [ Mac10.14 ] external/wpt/pointerevents/pointerevent_pointercapture_in_frame.html?pen [ Timeout ]
crbug.com/626703 [ Mac11 ] external/wpt/pointerevents/pointerevent_pointercapture_in_frame.html?pen [ Timeout ]
crbug.com/1265587 external/wpt/html/user-activation/activation-trigger-pointerevent.html?pen [ Failure ]
crbug.com/1270351 external/wpt/html/user-activation/activation-trigger-pointerevent.html?touch [ Failure ]
crbug.com/626703 external/wpt/html/cross-origin-opener-policy/iframe-popup-same-origin-to-unsafe-none.https.html [ Skip Timeout ]
crbug.com/626703 external/wpt/css/css-sizing/fit-content-length-percentage-006.html [ Failure ]
crbug.com/626703 external/wpt/css/css-sizing/fit-content-length-percentage-007.html [ Failure ]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#activation-triggering-input-event">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#activation-triggering-input-event">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#activation-triggering-input-event">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#activation-triggering-input-event">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
Expand All @@ -17,8 +18,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,62 @@
<!DOCTYPE html>
<html>
<head>
<link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#activation-triggering-input-event">
<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 ea9e04a

Please sign in to comment.