summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/event-timing
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/event-timing')
-rw-r--r--testing/web-platform/tests/event-timing/interactionid-orphan-pointerup.html31
-rw-r--r--testing/web-platform/tests/event-timing/resources/event-timing-test-utils.js12
2 files changed, 43 insertions, 0 deletions
diff --git a/testing/web-platform/tests/event-timing/interactionid-orphan-pointerup.html b/testing/web-platform/tests/event-timing/interactionid-orphan-pointerup.html
new file mode 100644
index 0000000000..9c4a0ecf58
--- /dev/null
+++ b/testing/web-platform/tests/event-timing/interactionid-orphan-pointerup.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8 />
+<title>Event Timing: interactionId-orphan-pointerup.</title>
+<button id='testButtonId'>Orphan Pointerup</button>
+<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/event-timing-test-utils.js></script>
+
+<script>
+ let observedEntries = [];
+ const map = new Map();
+ const events = ['pointerup'];
+
+ promise_test(async t => {
+ assert_implements(window.PerformanceEventTiming, 'Event Timing is not supported.');
+
+ const callback = (entryList) => { observedEntries = observedEntries.concat(entryList.getEntries().filter(filterAndAddToMap(events, map))); };
+ const readyToResolve = () => { return observedEntries.length >= 1; };
+ const observerPromise = createPerformanceObserverPromise(['event'], callback, readyToResolve);
+
+ await interactAndObserve('orphan-pointerup', document.getElementById('testButtonId'), observerPromise);
+ assert_equals(map.get('pointerup'), 0, 'Should have a trivial interactionId for orphan pointerup event.');
+ }, "Event Timing: Orphan pointerup should not be measured as an interaction.");
+
+</script>
+
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/event-timing/resources/event-timing-test-utils.js b/testing/web-platform/tests/event-timing/resources/event-timing-test-utils.js
index 9670d8d26f..7b281a4e0e 100644
--- a/testing/web-platform/tests/event-timing/resources/event-timing-test-utils.js
+++ b/testing/web-platform/tests/event-timing/resources/event-timing-test-utils.js
@@ -357,6 +357,13 @@ async function pointerdown(target) {
.send();
}
+async function pointerup(target) {
+ const actions = new test_driver.Actions();
+ return actions.addPointer("mousePointer", "mouse")
+ .pointerMove(0, 0, { origin: target })
+ .pointerUp()
+ .send();
+}
async function auxPointerdown(target) {
const actions = new test_driver.Actions();
return actions.addPointer("mousePointer", "mouse")
@@ -443,6 +450,11 @@ async function interactAndObserve(interactionType, target, observerPromise) {
interactionPromise = Promise.all([auxPointerdown(target), pointerdown(target)]);
break;
}
+ case 'orphan-pointerup': {
+ addListeners(target, ['pointerup']);
+ interactionPromise = pointerup(target);
+ break;
+ }
}
return Promise.all([interactionPromise, observerPromise]);
}