Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 9def4eb

Browse files
sahirvmoz-wptsync-bot
authored andcommitted
Bug 1904460 [wpt PR 46888] - Swap PointerEvent.deviceProperties with PointerEvent.persistentDeviceId, a=testonly
Automatic update from web-platform-tests Swap PointerEvent.deviceProperties with PointerEvent.persistentDeviceId Bring back a unique id on the base pointer event and remove deviceProperties. Rather than deviceId, this will be called persistentDeviceId. Spec: w3c/pointerevents#495 Change-Id: Ia284adc60bc4030b69dbec89d0e37117fecf3f83 Bug: 330760871 Reviewed-on: https://un5x4n0kwa1t164zhzvdp2b4bu49r4r40ry9xdr.julianrbryant.com/c/chromium/src/+/5643255 Commit-Queue: Sahir Vellani <sahir.vellani@microsoft.com> Reviewed-by: Olga Gerchikov <gerchiko@microsoft.com> Reviewed-by: Robert Flack <flackr@chromium.org> Cr-Commit-Position: refs/heads/main@{#1318886} -- wpt-commits: b29c0837b336a17d4aca09b9afbb82ac30748385 wpt-pr: 46888
1 parent 793b120 commit 9def4eb

File tree

3 files changed

+32
-54
lines changed

3 files changed

+32
-54
lines changed

testing/web-platform/tests/pointerevents/deviceproperties/get-device-properties-uniqueid-from-pointer-event.tentative.html renamed to testing/web-platform/tests/pointerevents/persistentDeviceId/get-persistendeviceid-from-pointer-event.tentative.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
</style>
1717
<div id="logger" draggable="false"></div>
1818
<div id="console"></div>
19-
<!-- This test verifies that pointerEvent.deviceProperties.uniqueId is 0
19+
<!-- This test verifies that pointerEvent.persistentDeviceId is 0
2020
by default for a pointer with an invalid hardware id - in this case
2121
a testdriver generated event, which does not support hardware id. -->
2222
<script>
2323
function CheckDeviceId(event) {
2424
eventFired++;
25-
assert_equals(event.deviceProperties.uniqueId, 0, "deviceId is 0");
25+
assert_equals(event.persistentDeviceId, 0, "deviceId is 0");
2626
}
2727

2828
window.addEventListener("pointerdown", CheckDeviceId, false);
@@ -41,5 +41,5 @@
4141
await actions.send();
4242

4343
assert_true(eventFired == 2);
44-
}, 'PointerEvent.deviceProperties.uniqueId');
44+
}, 'PointerEvent.persistentDeviceId');
4545
</script>

testing/web-platform/tests/pointerevents/deviceproperties/unique-id-is-unique-manual.tentative.html renamed to testing/web-platform/tests/pointerevents/persistentDeviceId/persistentdeviceid-is-unique-manual.tentative.html

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
Tentative; contingent on merge of:
44
https://github.com/w3c/pointerevents/pull/495
55
6-
This manual test validates the behavior of PointerEvent.deviceProperties.uniqueId.
6+
This manual test validates the behavior of PointerEvent.persistentDeviceId.
77
Specifically, this test ensures that pointing devices get their own unique id, and
88
that the unique id is persistent over the session.
99
1010
In order to run this test, it is necessary to have multiple pointing devices; such as a
1111
pen and a mouse. Please follow the instructions exactly as written in order to ensure
1212
the correct results are obtained.
1313
-->
14-
<title>DeviceProperties.uniqueId is unique for pointer events from different devices</title>
14+
<title>persistentDeviceId is unique for pointer events from different devices</title>
1515
<script src="/resources/testharness.js"></script>
1616
<script src="/resources/testharnessreport.js"></script>
1717
<style>
@@ -94,13 +94,10 @@ <h2>Instructions</h2>
9494
setup({explicit_timeout: true, explicit_done: true});
9595

9696
function LogDeviceId(event, list) {
97-
if (event.deviceProperties) {
98-
const uniqueId = event.deviceProperties.uniqueId;
99-
currentuniqueid.innerText = uniqueId ? uniqueId : "Unknown";
100-
if (!uniqueId) {
101-
return;
102-
}
103-
list.push(uniqueId);
97+
if (event.persistentDeviceId) {
98+
const persistentDeviceId = event.persistentDeviceId;
99+
currentuniqueid.innerText = persistentDeviceId ? persistentDeviceId : "Unknown";
100+
list.push(persistentDeviceId);
104101
}
105102
}
106103

@@ -117,17 +114,17 @@ <h2>Instructions</h2>
117114
let device2UniqueIds = new Set(device2Ids);
118115

119116
test(function () {
120-
assert_greater_than(device1Ids.length, 1, "Events from Device 1 have uniqueIds.");
121-
assert_equals(device1UniqueIds.size, 1, "Device 1 has a consistent uniqueId.");
122-
}, "uniqueId is consistent for device 1");
117+
assert_greater_than(device1Ids.length, 1, "Events from Device 1 have deviceIds.");
118+
assert_equals(device1UniqueIds.size, 1, "Device 1 has a consistent deviceId.");
119+
}, "deviceId is consistent for device 1");
123120
test(function () {
124-
assert_greater_than(device2Ids.length, 1, "Events from Device 2 have uniqueIds.");
125-
assert_equals(device2UniqueIds.size, 1, "Device 2 has a consistent uniqueId.");
126-
}, "uniqueId is consistent for device 2");
121+
assert_greater_than(device2Ids.length, 1, "Events from Device 2 have deviceIds.");
122+
assert_equals(device2UniqueIds.size, 1, "Device 2 has a consistent deviceId.");
123+
}, "deviceId is consistent for device 2");
127124
test(function () {
128125
// Ensure the two sets are different.
129-
assert_equals(device1UniqueIds.intersection(device2UniqueIds).size, 0, "Device 1 and 2 have different uniqueIds.");
130-
}, "uniqueId is unique to device 1 and device 2");
126+
assert_equals(device1UniqueIds.intersection(device2UniqueIds).size, 0, "Device 1 and 2 have different deviceIds.");
127+
}, "deviceId is unique to device 1 and device 2");
131128
done();
132129
}
133130

testing/web-platform/tests/pointerevents/deviceproperties/pointer-event-has-device-properties-uniqueid-from-pointer-event-init.tentative.html renamed to testing/web-platform/tests/pointerevents/persistentDeviceId/pointer-event-has-persistentdeviceid-from-pointer-event-init.tentative.html

Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,20 @@
77
<script src="/resources/testharnessreport.js"></script>
88
<div id="console"></div>
99

10-
<!-- This test verifies that pointerEvent.deviceProperties.uniqueId
10+
<!-- This test verifies that pointerEvent.persistentDeviceId
1111
can be set via PointerEventInit. -->
1212
<script>
13-
const UNIQUE_ID = 1001;
14-
const INVALID_UNIQUE_ID = 0;
13+
const PERSISTENT_ID = 1001;
14+
const INVALID_PERSISTENT_ID = 0;
1515

16-
function CheckDeviceId(event, uniqueId) {
17-
assert_equals(event.deviceProperties.uniqueId, uniqueId, "uniqueId is populated");
16+
function CheckDeviceId(event, persistentDeviceId) {
17+
assert_equals(event.persistentDeviceId, persistentDeviceId, "persistentDeviceId is populated");
1818
}
1919

2020
promise_test(async () => {
2121
if (!window.internals)
2222
return;
23-
var deviceProps = new DeviceProperties({
24-
uniqueId: 1001
25-
});
23+
var deviceId = PERSISTENT_ID;
2624
var downEvent = new PointerEvent("pointerdown",
2725
{pointerId: 1,
2826
bubbles: true,
@@ -31,9 +29,9 @@
3129
width: 100,
3230
height: 100,
3331
isPrimary: true,
34-
deviceProperties: deviceProps
32+
persistentDeviceId: deviceId
3533
});
36-
CheckDeviceId(downEvent, UNIQUE_ID);
34+
CheckDeviceId(downEvent, PERSISTENT_ID);
3735
var moveEvent = new PointerEvent("pointermove",
3836
{pointerId: 1,
3937
bubbles: true,
@@ -42,9 +40,9 @@
4240
width: 100,
4341
height: 100,
4442
isPrimary: true,
45-
deviceProperties: deviceProps
43+
persistentDeviceId: deviceId
4644
});
47-
CheckDeviceId(moveEvent, UNIQUE_ID);
45+
CheckDeviceId(moveEvent, PERSISTENT_ID);
4846
var upEvent = new PointerEvent("pointerup",
4947
{pointerId: 1,
5048
bubbles: true,
@@ -53,27 +51,10 @@
5351
width: 100,
5452
height: 100,
5553
isPrimary: true,
56-
deviceProperties: deviceProps
54+
persistentDeviceId: deviceId
5755
});
58-
CheckDeviceId(upEvent, UNIQUE_ID);
59-
}, 'PointerEvent.deviceProperties via DevicePropertiesInit');
60-
61-
promise_test(async () => {
62-
if (!window.internals)
63-
return;
64-
var emptyDeviceProps = new DeviceProperties({});
65-
var downEventEmptyProps = new PointerEvent("pointerdown",
66-
{pointerId: 1,
67-
bubbles: true,
68-
cancelable: true,
69-
pointerType: "pen",
70-
width: 100,
71-
height: 100,
72-
isPrimary: true,
73-
deviceProperties: emptyDeviceProps
74-
});
75-
CheckDeviceId(downEventEmptyProps, INVALID_UNIQUE_ID);
76-
}, 'PointerEvent.deviceProperties via empty DevicePropertiesInit');
56+
CheckDeviceId(upEvent, PERSISTENT_ID);
57+
}, 'PointerEvent.persistentDeviceId via PointerEventInit');
7758

7859
promise_test(async () => {
7960
if (!window.internals)
@@ -87,6 +68,6 @@
8768
height: 100,
8869
isPrimary: true,
8970
});
90-
assert_equals(downEventEmptyProps.deviceProperties, null);
91-
}, 'No deviceProperties in PointerEventInit');
71+
assert_equals(downEventEmptyProps.persistentDeviceId, INVALID_PERSISTENT_ID);
72+
}, 'No persistentDeviceId in PointerEventInit');
9273
</script>

0 commit comments

Comments
 (0)