summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/event-timing/interactionid-aux-pointerdown-and-pointerdown.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/event-timing/interactionid-aux-pointerdown-and-pointerdown.html
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/event-timing/interactionid-aux-pointerdown-and-pointerdown.html')
-rw-r--r--testing/web-platform/tests/event-timing/interactionid-aux-pointerdown-and-pointerdown.html49
1 files changed, 49 insertions, 0 deletions
diff --git a/testing/web-platform/tests/event-timing/interactionid-aux-pointerdown-and-pointerdown.html b/testing/web-platform/tests/event-timing/interactionid-aux-pointerdown-and-pointerdown.html
new file mode 100644
index 0000000000..a46ca67277
--- /dev/null
+++ b/testing/web-platform/tests/event-timing/interactionid-aux-pointerdown-and-pointerdown.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8 />
+<title>Event Timing: interactionId-aux-pointerdown-and-pointerdown</title>
+<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>
+<div id='target'>Right click me to bring up OS level contextmenu popup.</div>
+
+<script>
+ let platformSupported = false;
+ const map = new Map();
+ const events = ['pointerdown'];
+
+ // This test replicates a real world scenario that - on triggering contextmenu
+ // with a pointer, pointerdown is captured but not pointerup. (crbug/1413096)
+ // In this case, we need to make sure event timing will correctly report the
+ // pointerdown entry with a valid/non-trivial interactionId.
+ promise_test(async t => {
+ assert_implements(window.PerformanceEventTiming, 'Event Timing is not supported.');
+ // This test is not applicable to platforms like Windows where contextmenu
+ // is triggered on aux pointerup. So we do a platform behavior test first to
+ // distinguish and skip those platforms who do not dispatch contextmenu on
+ // aux pointerdown.
+ document.getElementById('target').addEventListener('contextmenu', () => { platformSupported = true; });
+ await auxPointerdown(document.getElementById('target'));
+ // 2000ms is a magic number picked to wait for contextmenu being observed
+ // from the performance observer. Consider enlarge it if flaky.
+ await t.step_timeout(() => { }, 2000);
+ if (!platformSupported) {
+ return;
+ }
+
+ // Perform test on qualified platforms
+ const callback = (entryList) => { entryList.getEntries().filter(filterAndAddToMap(events, map)); };
+ const readyToResolve = () => { return map.has('pointerdown'); };
+ const observerPromise = createPerformanceObserverPromise(['event'], callback, readyToResolve);
+
+ await interactAndObserve('aux-pointerdown-and-pointerdown', document.getElementById('target'), observerPromise);
+
+ assert_greater_than(map.get('pointerdown'), 0, 'The pointerdown entry should have a non-trivial interactionId');
+ }, "Event Timing: verify pointerdown reporting for mouse aux pointerdown only triggered contextmenu followed immediately by another pointerdown event.");
+
+</script>
+
+</html>