From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- testing/web-platform/tests/event-timing/META.yml | 3 + .../web-platform/tests/event-timing/auxclick.html | 17 + .../buffered-and-duration-threshold.html | 44 +++ .../tests/event-timing/buffered-flag.html | 46 +++ .../tests/event-timing/click-timing.html | 62 +++ testing/web-platform/tests/event-timing/click.html | 17 + .../tests/event-timing/contextmenu.html | 21 + .../tests/event-timing/crossiframe.html | 94 +++++ .../web-platform/tests/event-timing/dblclick.html | 18 + .../tests/event-timing/disconnect-target.html | 34 ++ .../event-timing/duration-with-target-low.html | 16 + .../tests/event-timing/event-click-counts.html | 46 +++ .../event-timing/event-click-visibilitychange.html | 98 +++++ .../tests/event-timing/event-counts-zero.html | 57 +++ .../tests/event-timing/event-retarget.html | 41 ++ .../first-input-interactionid-click.html | 51 +++ .../first-input-interactionid-tap.html | 52 +++ .../tests/event-timing/first-input-shadow-dom.html | 42 ++ .../tests/event-timing/idlharness.any.js | 20 + .../event-timing/interaction-count-click.html | 16 + .../event-timing/interaction-count-press-key.html | 17 + .../tests/event-timing/interaction-count-tap.html | 17 + .../tests/event-timing/interactionid-click.html | 42 ++ .../interactionid-press-key-as-input.html | 38 ++ .../interactionid-press-key-no-effect.html | 43 ++ .../tests/event-timing/interactionid-tap.html | 31 ++ .../web-platform/tests/event-timing/keydown.html | 17 + testing/web-platform/tests/event-timing/keyup.html | 17 + .../event-timing/large-duration-threshold.html | 16 + .../event-timing/medium-duration-threshold.html | 16 + .../tests/event-timing/min-duration-threshold.html | 16 + .../web-platform/tests/event-timing/mousedown.html | 18 + .../tests/event-timing/mouseenter.html | 19 + .../tests/event-timing/mouseleave.html | 19 + .../web-platform/tests/event-timing/mouseout.html | 18 + .../web-platform/tests/event-timing/mouseover.html | 18 + .../web-platform/tests/event-timing/mouseup.html | 17 + .../event-timing/only-observe-firstInput.html | 51 +++ .../tests/event-timing/pointerdown.html | 18 + .../tests/event-timing/pointerenter.html | 20 + .../tests/event-timing/pointerleave.html | 19 + .../tests/event-timing/pointerout.html | 18 + .../tests/event-timing/pointerover.html | 18 + .../web-platform/tests/event-timing/pointerup.html | 17 + .../programmatic-click-not-observed.html | 51 +++ .../resources/crossiframe-childframe.html | 39 ++ .../resources/event-timing-test-utils.js | 437 +++++++++++++++++++++ .../tests/event-timing/resources/slow-image.py | 7 + .../tests/event-timing/retrievability.html | 44 +++ .../tests/event-timing/retrieve-firstInput.html | 36 ++ .../tests/event-timing/shadow-dom-null-target.html | 69 ++++ .../supported-types-consistent-with-self.html | 19 + .../tests/event-timing/supported-types.window.js | 12 + .../tests/event-timing/timingconditions.html | 69 ++++ .../web-platform/tests/event-timing/toJSON.html | 42 ++ 55 files changed, 2160 insertions(+) create mode 100644 testing/web-platform/tests/event-timing/META.yml create mode 100644 testing/web-platform/tests/event-timing/auxclick.html create mode 100644 testing/web-platform/tests/event-timing/buffered-and-duration-threshold.html create mode 100644 testing/web-platform/tests/event-timing/buffered-flag.html create mode 100644 testing/web-platform/tests/event-timing/click-timing.html create mode 100644 testing/web-platform/tests/event-timing/click.html create mode 100644 testing/web-platform/tests/event-timing/contextmenu.html create mode 100644 testing/web-platform/tests/event-timing/crossiframe.html create mode 100644 testing/web-platform/tests/event-timing/dblclick.html create mode 100644 testing/web-platform/tests/event-timing/disconnect-target.html create mode 100644 testing/web-platform/tests/event-timing/duration-with-target-low.html create mode 100644 testing/web-platform/tests/event-timing/event-click-counts.html create mode 100644 testing/web-platform/tests/event-timing/event-click-visibilitychange.html create mode 100644 testing/web-platform/tests/event-timing/event-counts-zero.html create mode 100644 testing/web-platform/tests/event-timing/event-retarget.html create mode 100644 testing/web-platform/tests/event-timing/first-input-interactionid-click.html create mode 100644 testing/web-platform/tests/event-timing/first-input-interactionid-tap.html create mode 100644 testing/web-platform/tests/event-timing/first-input-shadow-dom.html create mode 100644 testing/web-platform/tests/event-timing/idlharness.any.js create mode 100644 testing/web-platform/tests/event-timing/interaction-count-click.html create mode 100644 testing/web-platform/tests/event-timing/interaction-count-press-key.html create mode 100644 testing/web-platform/tests/event-timing/interaction-count-tap.html create mode 100644 testing/web-platform/tests/event-timing/interactionid-click.html create mode 100644 testing/web-platform/tests/event-timing/interactionid-press-key-as-input.html create mode 100644 testing/web-platform/tests/event-timing/interactionid-press-key-no-effect.html create mode 100644 testing/web-platform/tests/event-timing/interactionid-tap.html create mode 100644 testing/web-platform/tests/event-timing/keydown.html create mode 100644 testing/web-platform/tests/event-timing/keyup.html create mode 100644 testing/web-platform/tests/event-timing/large-duration-threshold.html create mode 100644 testing/web-platform/tests/event-timing/medium-duration-threshold.html create mode 100644 testing/web-platform/tests/event-timing/min-duration-threshold.html create mode 100644 testing/web-platform/tests/event-timing/mousedown.html create mode 100644 testing/web-platform/tests/event-timing/mouseenter.html create mode 100644 testing/web-platform/tests/event-timing/mouseleave.html create mode 100644 testing/web-platform/tests/event-timing/mouseout.html create mode 100644 testing/web-platform/tests/event-timing/mouseover.html create mode 100644 testing/web-platform/tests/event-timing/mouseup.html create mode 100644 testing/web-platform/tests/event-timing/only-observe-firstInput.html create mode 100644 testing/web-platform/tests/event-timing/pointerdown.html create mode 100644 testing/web-platform/tests/event-timing/pointerenter.html create mode 100644 testing/web-platform/tests/event-timing/pointerleave.html create mode 100644 testing/web-platform/tests/event-timing/pointerout.html create mode 100644 testing/web-platform/tests/event-timing/pointerover.html create mode 100644 testing/web-platform/tests/event-timing/pointerup.html create mode 100644 testing/web-platform/tests/event-timing/programmatic-click-not-observed.html create mode 100644 testing/web-platform/tests/event-timing/resources/crossiframe-childframe.html create mode 100644 testing/web-platform/tests/event-timing/resources/event-timing-test-utils.js create mode 100644 testing/web-platform/tests/event-timing/resources/slow-image.py create mode 100644 testing/web-platform/tests/event-timing/retrievability.html create mode 100644 testing/web-platform/tests/event-timing/retrieve-firstInput.html create mode 100644 testing/web-platform/tests/event-timing/shadow-dom-null-target.html create mode 100644 testing/web-platform/tests/event-timing/supported-types-consistent-with-self.html create mode 100644 testing/web-platform/tests/event-timing/supported-types.window.js create mode 100644 testing/web-platform/tests/event-timing/timingconditions.html create mode 100644 testing/web-platform/tests/event-timing/toJSON.html (limited to 'testing/web-platform/tests/event-timing') diff --git a/testing/web-platform/tests/event-timing/META.yml b/testing/web-platform/tests/event-timing/META.yml new file mode 100644 index 0000000000..e38d492da0 --- /dev/null +++ b/testing/web-platform/tests/event-timing/META.yml @@ -0,0 +1,3 @@ +spec: https://wicg.github.io/event-timing/ +suggested_reviewers: + - npm1 diff --git a/testing/web-platform/tests/event-timing/auxclick.html b/testing/web-platform/tests/event-timing/auxclick.html new file mode 100644 index 0000000000..b88328e2aa --- /dev/null +++ b/testing/web-platform/tests/event-timing/auxclick.html @@ -0,0 +1,17 @@ + + + +Event Timing auxclick. + + + + + + +
Click me
+ + diff --git a/testing/web-platform/tests/event-timing/buffered-and-duration-threshold.html b/testing/web-platform/tests/event-timing/buffered-and-duration-threshold.html new file mode 100644 index 0000000000..4a7a63f59a --- /dev/null +++ b/testing/web-platform/tests/event-timing/buffered-and-duration-threshold.html @@ -0,0 +1,44 @@ + + + +Event Timing: PerformanceObserver with buffered flag and durationThreshold + + + + + +
Click me
+ + diff --git a/testing/web-platform/tests/event-timing/buffered-flag.html b/testing/web-platform/tests/event-timing/buffered-flag.html new file mode 100644 index 0000000000..7ee152be93 --- /dev/null +++ b/testing/web-platform/tests/event-timing/buffered-flag.html @@ -0,0 +1,46 @@ + + + +Event Timing: PerformanceObserver sees entries with buffered flag + + + + + + + + diff --git a/testing/web-platform/tests/event-timing/click-timing.html b/testing/web-platform/tests/event-timing/click-timing.html new file mode 100644 index 0000000000..24bad0aedc --- /dev/null +++ b/testing/web-platform/tests/event-timing/click-timing.html @@ -0,0 +1,62 @@ + + + +Event Timing: compare timing of two long clicks + + + + + + + + + diff --git a/testing/web-platform/tests/event-timing/click.html b/testing/web-platform/tests/event-timing/click.html new file mode 100644 index 0000000000..e3eecabdf1 --- /dev/null +++ b/testing/web-platform/tests/event-timing/click.html @@ -0,0 +1,17 @@ + + + +Event Timing click. + + + + + + +
Click me
+ + diff --git a/testing/web-platform/tests/event-timing/contextmenu.html b/testing/web-platform/tests/event-timing/contextmenu.html new file mode 100644 index 0000000000..9aa05a3b16 --- /dev/null +++ b/testing/web-platform/tests/event-timing/contextmenu.html @@ -0,0 +1,21 @@ + + + +Event Timing contextmenu. + + + + + + +
Menu + + + +
+ + diff --git a/testing/web-platform/tests/event-timing/crossiframe.html b/testing/web-platform/tests/event-timing/crossiframe.html new file mode 100644 index 0000000000..df4d94f09a --- /dev/null +++ b/testing/web-platform/tests/event-timing/crossiframe.html @@ -0,0 +1,94 @@ + + + + + + Event Timing: entries should be observable by its own frame. + + + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/event-timing/dblclick.html b/testing/web-platform/tests/event-timing/dblclick.html new file mode 100644 index 0000000000..d33fcfd30d --- /dev/null +++ b/testing/web-platform/tests/event-timing/dblclick.html @@ -0,0 +1,18 @@ + + + +Event Timing dblclick. + + + + + + +
Outside target!
+
Click me
+ + diff --git a/testing/web-platform/tests/event-timing/disconnect-target.html b/testing/web-platform/tests/event-timing/disconnect-target.html new file mode 100644 index 0000000000..04c7c290b6 --- /dev/null +++ b/testing/web-platform/tests/event-timing/disconnect-target.html @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/event-timing/duration-with-target-low.html b/testing/web-platform/tests/event-timing/duration-with-target-low.html new file mode 100644 index 0000000000..11a8c3ae47 --- /dev/null +++ b/testing/web-platform/tests/event-timing/duration-with-target-low.html @@ -0,0 +1,16 @@ + + + +Event Timing: PerformanceObserver with a durationThreshold way smaller than processingDelay + + + + + +
Click me
+ + diff --git a/testing/web-platform/tests/event-timing/event-click-counts.html b/testing/web-platform/tests/event-timing/event-click-counts.html new file mode 100644 index 0000000000..6c6563b958 --- /dev/null +++ b/testing/web-platform/tests/event-timing/event-click-counts.html @@ -0,0 +1,46 @@ + + + +Event Timing: eventCounts. + + + + +
Click me
+ + + diff --git a/testing/web-platform/tests/event-timing/event-click-visibilitychange.html b/testing/web-platform/tests/event-timing/event-click-visibilitychange.html new file mode 100644 index 0000000000..beb3ba3512 --- /dev/null +++ b/testing/web-platform/tests/event-timing/event-click-visibilitychange.html @@ -0,0 +1,98 @@ + + + + +Event Timing: eventCounts. + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/event-timing/event-counts-zero.html b/testing/web-platform/tests/event-timing/event-counts-zero.html new file mode 100644 index 0000000000..e00eb40255 --- /dev/null +++ b/testing/web-platform/tests/event-timing/event-counts-zero.html @@ -0,0 +1,57 @@ + + + +Event Timing: eventCounts. + + + + + + diff --git a/testing/web-platform/tests/event-timing/event-retarget.html b/testing/web-platform/tests/event-timing/event-retarget.html new file mode 100644 index 0000000000..2ddc85d566 --- /dev/null +++ b/testing/web-platform/tests/event-timing/event-retarget.html @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/event-timing/first-input-interactionid-click.html b/testing/web-platform/tests/event-timing/first-input-interactionid-click.html new file mode 100644 index 0000000000..bcd4079256 --- /dev/null +++ b/testing/web-platform/tests/event-timing/first-input-interactionid-click.html @@ -0,0 +1,51 @@ + + + +First Input: interactionId-click. + + + + + + + + + + diff --git a/testing/web-platform/tests/event-timing/first-input-interactionid-tap.html b/testing/web-platform/tests/event-timing/first-input-interactionid-tap.html new file mode 100644 index 0000000000..f5e080eb16 --- /dev/null +++ b/testing/web-platform/tests/event-timing/first-input-interactionid-tap.html @@ -0,0 +1,52 @@ + + + +First Input: interactionId-tap. + + + + + + + + + + + diff --git a/testing/web-platform/tests/event-timing/first-input-shadow-dom.html b/testing/web-platform/tests/event-timing/first-input-shadow-dom.html new file mode 100644 index 0000000000..5911dabd54 --- /dev/null +++ b/testing/web-platform/tests/event-timing/first-input-shadow-dom.html @@ -0,0 +1,42 @@ + + + + + + + + + +
+ +
+ + + diff --git a/testing/web-platform/tests/event-timing/idlharness.any.js b/testing/web-platform/tests/event-timing/idlharness.any.js new file mode 100644 index 0000000000..b1b57a4bb1 --- /dev/null +++ b/testing/web-platform/tests/event-timing/idlharness.any.js @@ -0,0 +1,20 @@ +// META: global=window,worker +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +// https://wicg.github.io/event-timing/ + +'use strict'; + +idl_test( + ['event-timing'], + ['performance-timeline', 'hr-time', 'dom'], + idl_array => { + idl_array.add_objects({ + Performance: ['performance'], + EventCounts: ['performance.eventCounts'], + InteractionCounts: ['performance.interactionCounts'], + // PerformanceEventTiming: [ TODO ] + }); + } +); diff --git a/testing/web-platform/tests/event-timing/interaction-count-click.html b/testing/web-platform/tests/event-timing/interaction-count-click.html new file mode 100644 index 0000000000..73d748c7bd --- /dev/null +++ b/testing/web-platform/tests/event-timing/interaction-count-click.html @@ -0,0 +1,16 @@ + + + +Event Timing: interactionCount-click +
Click me
+ + + + + + + + + diff --git a/testing/web-platform/tests/event-timing/interaction-count-press-key.html b/testing/web-platform/tests/event-timing/interaction-count-press-key.html new file mode 100644 index 0000000000..d0d55321a1 --- /dev/null +++ b/testing/web-platform/tests/event-timing/interaction-count-press-key.html @@ -0,0 +1,17 @@ + + + +Event Timing: interactionCount-press-key + + + + + + + + + + + diff --git a/testing/web-platform/tests/event-timing/interaction-count-tap.html b/testing/web-platform/tests/event-timing/interaction-count-tap.html new file mode 100644 index 0000000000..561bf5f917 --- /dev/null +++ b/testing/web-platform/tests/event-timing/interaction-count-tap.html @@ -0,0 +1,17 @@ + + + +Event Timing: interactionCount-tap +
Tap me
+ + + + + + + + + + diff --git a/testing/web-platform/tests/event-timing/interactionid-click.html b/testing/web-platform/tests/event-timing/interactionid-click.html new file mode 100644 index 0000000000..1506e31e1d --- /dev/null +++ b/testing/web-platform/tests/event-timing/interactionid-click.html @@ -0,0 +1,42 @@ + + + +Event Timing: interactionId-click. + + + + + + + + diff --git a/testing/web-platform/tests/event-timing/interactionid-press-key-as-input.html b/testing/web-platform/tests/event-timing/interactionid-press-key-as-input.html new file mode 100644 index 0000000000..b1e725b5c6 --- /dev/null +++ b/testing/web-platform/tests/event-timing/interactionid-press-key-as-input.html @@ -0,0 +1,38 @@ + + + + +Event Timing: interactionId-press-key-as-input. + + + + + + + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/event-timing/interactionid-press-key-no-effect.html b/testing/web-platform/tests/event-timing/interactionid-press-key-no-effect.html new file mode 100644 index 0000000000..ad4dc2595c --- /dev/null +++ b/testing/web-platform/tests/event-timing/interactionid-press-key-no-effect.html @@ -0,0 +1,43 @@ + + + + +Event Timing: interactionId-press-key-no-effect. + + + + + + + + +

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec tempus + lacinia nisi, eget tempor orci. Nullam congue pharetra arcu, et consectetur + massa mollis tincidunt. Quisque odio sapien, viverra finibus lectus ac, + consectetur ornare quam. In hac habitasse platea dictumst. Morbi cursus est + odio, non fermentum ligula posuere vitae. Sed ullamcorper convallis rhoncus. + In condimentum neque nec metus hendrerit, et cursus ipsum aliquet. +

+ + \ No newline at end of file diff --git a/testing/web-platform/tests/event-timing/interactionid-tap.html b/testing/web-platform/tests/event-timing/interactionid-tap.html new file mode 100644 index 0000000000..6545369088 --- /dev/null +++ b/testing/web-platform/tests/event-timing/interactionid-tap.html @@ -0,0 +1,31 @@ + + + +Event Timing: interactionId-tap. + + + + + + + + + + diff --git a/testing/web-platform/tests/event-timing/keydown.html b/testing/web-platform/tests/event-timing/keydown.html new file mode 100644 index 0000000000..fd814e12b4 --- /dev/null +++ b/testing/web-platform/tests/event-timing/keydown.html @@ -0,0 +1,17 @@ + + + +Event Timing Keydown. + + + + + + + + + diff --git a/testing/web-platform/tests/event-timing/keyup.html b/testing/web-platform/tests/event-timing/keyup.html new file mode 100644 index 0000000000..0ec3670de0 --- /dev/null +++ b/testing/web-platform/tests/event-timing/keyup.html @@ -0,0 +1,17 @@ + + + +Event Timing Keyup. + + + + + + + + + diff --git a/testing/web-platform/tests/event-timing/large-duration-threshold.html b/testing/web-platform/tests/event-timing/large-duration-threshold.html new file mode 100644 index 0000000000..4eed8d9756 --- /dev/null +++ b/testing/web-platform/tests/event-timing/large-duration-threshold.html @@ -0,0 +1,16 @@ + + + +Event Timing: PerformanceObserver with a durationThreshold of 125 + + + + + +
Click me
+ + diff --git a/testing/web-platform/tests/event-timing/medium-duration-threshold.html b/testing/web-platform/tests/event-timing/medium-duration-threshold.html new file mode 100644 index 0000000000..a2f79cf6fe --- /dev/null +++ b/testing/web-platform/tests/event-timing/medium-duration-threshold.html @@ -0,0 +1,16 @@ + + + +Event Timing: PerformanceObserver with a durationThreshold of 50 + + + + + +
Click me
+ + diff --git a/testing/web-platform/tests/event-timing/min-duration-threshold.html b/testing/web-platform/tests/event-timing/min-duration-threshold.html new file mode 100644 index 0000000000..b7382f9457 --- /dev/null +++ b/testing/web-platform/tests/event-timing/min-duration-threshold.html @@ -0,0 +1,16 @@ + + + +Event Timing: PerformanceObserver with a durationThreshold less than 16 + + + + + +
Click me
+ + diff --git a/testing/web-platform/tests/event-timing/mousedown.html b/testing/web-platform/tests/event-timing/mousedown.html new file mode 100644 index 0000000000..35a07faeb1 --- /dev/null +++ b/testing/web-platform/tests/event-timing/mousedown.html @@ -0,0 +1,18 @@ + + + + +Event Timing mousedown. + + + + + + +
Click me
+ + diff --git a/testing/web-platform/tests/event-timing/mouseenter.html b/testing/web-platform/tests/event-timing/mouseenter.html new file mode 100644 index 0000000000..1d0171ec46 --- /dev/null +++ b/testing/web-platform/tests/event-timing/mouseenter.html @@ -0,0 +1,19 @@ + + + +Event Timing mouseenter. + + + + + + +
Outside target!
+
Target
+ + diff --git a/testing/web-platform/tests/event-timing/mouseleave.html b/testing/web-platform/tests/event-timing/mouseleave.html new file mode 100644 index 0000000000..b3cf1447e3 --- /dev/null +++ b/testing/web-platform/tests/event-timing/mouseleave.html @@ -0,0 +1,19 @@ + + + +Event Timing mouseleave. + + + + + + +
Outside target!
+
Target
+ + diff --git a/testing/web-platform/tests/event-timing/mouseout.html b/testing/web-platform/tests/event-timing/mouseout.html new file mode 100644 index 0000000000..dd321934b0 --- /dev/null +++ b/testing/web-platform/tests/event-timing/mouseout.html @@ -0,0 +1,18 @@ + + + +Event Timing mouseout. + + + + + + +
Outside target!
+
Target
+ + diff --git a/testing/web-platform/tests/event-timing/mouseover.html b/testing/web-platform/tests/event-timing/mouseover.html new file mode 100644 index 0000000000..741ee2d7ec --- /dev/null +++ b/testing/web-platform/tests/event-timing/mouseover.html @@ -0,0 +1,18 @@ + + + +Event Timing mouseover. + + + + + + +
Outside target!
+
Target
+ + diff --git a/testing/web-platform/tests/event-timing/mouseup.html b/testing/web-platform/tests/event-timing/mouseup.html new file mode 100644 index 0000000000..653bef8fdb --- /dev/null +++ b/testing/web-platform/tests/event-timing/mouseup.html @@ -0,0 +1,17 @@ + + + +Event Timing mouseup. + + + + + + +
Target
+ + diff --git a/testing/web-platform/tests/event-timing/only-observe-firstInput.html b/testing/web-platform/tests/event-timing/only-observe-firstInput.html new file mode 100644 index 0000000000..53f9641672 --- /dev/null +++ b/testing/web-platform/tests/event-timing/only-observe-firstInput.html @@ -0,0 +1,51 @@ + + + +Event Timing: only observe the first input + + + + + + + + + + diff --git a/testing/web-platform/tests/event-timing/pointerdown.html b/testing/web-platform/tests/event-timing/pointerdown.html new file mode 100644 index 0000000000..2eb6ae898c --- /dev/null +++ b/testing/web-platform/tests/event-timing/pointerdown.html @@ -0,0 +1,18 @@ + + + + +Event Timing pointerdown. + + + + + + +
Target
+ + diff --git a/testing/web-platform/tests/event-timing/pointerenter.html b/testing/web-platform/tests/event-timing/pointerenter.html new file mode 100644 index 0000000000..bb8ee08abc --- /dev/null +++ b/testing/web-platform/tests/event-timing/pointerenter.html @@ -0,0 +1,20 @@ + + + +Event Timing pointerenter. + + + + + + +
Outside target!
+
Target
+ + diff --git a/testing/web-platform/tests/event-timing/pointerleave.html b/testing/web-platform/tests/event-timing/pointerleave.html new file mode 100644 index 0000000000..b17464e0e7 --- /dev/null +++ b/testing/web-platform/tests/event-timing/pointerleave.html @@ -0,0 +1,19 @@ + + + +Event Timing pointerleave. + + + + + + +
Outside target!
+
Target
+ + diff --git a/testing/web-platform/tests/event-timing/pointerout.html b/testing/web-platform/tests/event-timing/pointerout.html new file mode 100644 index 0000000000..b08f57699c --- /dev/null +++ b/testing/web-platform/tests/event-timing/pointerout.html @@ -0,0 +1,18 @@ + + + +Event Timing pointerout. + + + + + + +
Outside target!
+
Target
+ + diff --git a/testing/web-platform/tests/event-timing/pointerover.html b/testing/web-platform/tests/event-timing/pointerover.html new file mode 100644 index 0000000000..0e1712239c --- /dev/null +++ b/testing/web-platform/tests/event-timing/pointerover.html @@ -0,0 +1,18 @@ + + + +Event Timing pointerover. + + + + + + +
Outside target!
+
Target
+ + diff --git a/testing/web-platform/tests/event-timing/pointerup.html b/testing/web-platform/tests/event-timing/pointerup.html new file mode 100644 index 0000000000..4324a5beb7 --- /dev/null +++ b/testing/web-platform/tests/event-timing/pointerup.html @@ -0,0 +1,17 @@ + + + +Event Timing pointerup. + + + + + + +
Target
+ + diff --git a/testing/web-platform/tests/event-timing/programmatic-click-not-observed.html b/testing/web-platform/tests/event-timing/programmatic-click-not-observed.html new file mode 100644 index 0000000000..049607e04e --- /dev/null +++ b/testing/web-platform/tests/event-timing/programmatic-click-not-observed.html @@ -0,0 +1,51 @@ + + + +
Click me
+
No, click me!
+ + + + + + + + diff --git a/testing/web-platform/tests/event-timing/resources/crossiframe-childframe.html b/testing/web-platform/tests/event-timing/resources/crossiframe-childframe.html new file mode 100644 index 0000000000..6a8bc6b642 --- /dev/null +++ b/testing/web-platform/tests/event-timing/resources/crossiframe-childframe.html @@ -0,0 +1,39 @@ + + + + +
+ + + 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 new file mode 100644 index 0000000000..66aa05a165 --- /dev/null +++ b/testing/web-platform/tests/event-timing/resources/event-timing-test-utils.js @@ -0,0 +1,437 @@ +// Clicks on the element with the given ID. It adds an event handler to the element which +// ensures that the events have a duration of at least |delay|. Calls |callback| during +// event handler if |callback| is provided. +async function clickOnElementAndDelay(id, delay, callback) { + const element = document.getElementById(id); + const clickHandler = () => { + mainThreadBusy(delay); + if (callback) { + callback(); + } + element.removeEventListener("pointerdown", clickHandler); + }; + + element.addEventListener("pointerdown", clickHandler); + await test_driver.click(element); +} + +function mainThreadBusy(duration) { + const now = performance.now(); + while (performance.now() < now + duration); +} + +// This method should receive an entry of type 'event'. |isFirst| is true only when we want +// to check that the event also happens to correspond to the first event. In this case, the +// timings of the 'first-input' entry should be equal to those of this entry. |minDuration| +// is used to compared against entry.duration. +function verifyEvent(entry, eventType, targetId, isFirst=false, minDuration=104, notCancelable=false) { + assert_equals(entry.cancelable, !notCancelable, 'cancelable property'); + assert_equals(entry.name, eventType); + assert_equals(entry.entryType, 'event'); + assert_greater_than_equal(entry.duration, minDuration, + "The entry's duration should be greater than or equal to " + minDuration + " ms."); + assert_greater_than_equal(entry.processingStart, entry.startTime, + "The entry's processingStart should be greater than or equal to startTime."); + assert_greater_than_equal(entry.processingEnd, entry.processingStart, + "The entry's processingEnd must be at least as large as processingStart."); + // |duration| is a number rounded to the nearest 8 ms, so add 4 to get a lower bound + // on the actual duration. + assert_greater_than_equal(entry.duration + 4, entry.processingEnd - entry.startTime, + "The entry's duration must be at least as large as processingEnd - startTime."); + if (isFirst) { + let firstInputs = performance.getEntriesByType('first-input'); + assert_equals(firstInputs.length, 1, 'There should be a single first-input entry'); + let firstInput = firstInputs[0]; + assert_equals(firstInput.name, entry.name); + assert_equals(firstInput.entryType, 'first-input'); + assert_equals(firstInput.startTime, entry.startTime); + assert_equals(firstInput.duration, entry.duration); + assert_equals(firstInput.processingStart, entry.processingStart); + assert_equals(firstInput.processingEnd, entry.processingEnd); + assert_equals(firstInput.cancelable, entry.cancelable); + } + if (targetId) + assert_equals(entry.target, document.getElementById(targetId)); +} + +function verifyClickEvent(entry, targetId, isFirst=false, minDuration=104, event='pointerdown') { + verifyEvent(entry, event, targetId, isFirst, minDuration); +} + +function wait() { + return new Promise((resolve, reject) => { + step_timeout(() => { + resolve(); + }, 0); + }); +} + +function clickAndBlockMain(id) { + return new Promise((resolve, reject) => { + clickOnElementAndDelay(id, 120, resolve); + }); +} + +function waitForTick() { + return new Promise(resolve => { + window.requestAnimationFrame(() => { + window.requestAnimationFrame(resolve); + }); + }); +} + // Add a PerformanceObserver and observe with a durationThreshold of |dur|. This test will + // attempt to check that the duration is appropriately checked by: + // * Asserting that entries received have a duration which is the smallest multiple of 8 + // that is greater than or equal to |dur|. + // * Issuing |numEntries| entries that has duration greater than |slowDur|. + // * Asserting that exactly |numEntries| entries are received. + // Parameters: + // |t| - the test harness. + // |dur| - the durationThreshold for the PerformanceObserver. + // |id| - the ID of the element to be clicked. + // |numEntries| - the number of entries. + // |slowDur| - the min duration of a slow entry. +async function testDuration(t, id, numEntries, dur, slowDur) { + assert_implements(window.PerformanceEventTiming, 'Event Timing is not supported.'); + const observerPromise = new Promise(async resolve => { + let minDuration = Math.ceil(dur / 8) * 8; + // Exposed events must always have a minimum duration of 16. + minDuration = Math.max(minDuration, 16); + let numEntriesReceived = 0; + new PerformanceObserver(list => { + const pointerDowns = list.getEntriesByName('pointerdown'); + pointerDowns.forEach(e => { + t.step(() => { + verifyClickEvent(e, id, false /* isFirst */, minDuration); + }); + }); + numEntriesReceived += pointerDowns.length; + // All the entries should be received since the slowDur is higher + // than the duration threshold. + if (numEntriesReceived === numEntries) + resolve(); + }).observe({type: "event", durationThreshold: dur}); + }); + const clicksPromise = new Promise(async resolve => { + for (let index = 0; index < numEntries; index++) { + // Add some click events that has at least slowDur for duration. + await clickOnElementAndDelay(id, slowDur); + } + resolve(); + }); + return Promise.all([observerPromise, clicksPromise]); +} + + // Add a PerformanceObserver and observe with a durationThreshold of |durThreshold|. This test will + // attempt to check that the duration is appropriately checked by: + // * Asserting that entries received have a duration which is the smallest multiple of 8 + // that is greater than or equal to |durThreshold|. + // * Issuing |numEntries| entries that have at least |processingDelay| as duration. + // * Asserting that the entries we receive has duration greater than or equals to the + // duration threshold we setup + // Parameters: + // |t| - the test harness. + // |id| - the ID of the element to be clicked. + // |durThreshold| - the durationThreshold for the PerformanceObserver. + // |numEntries| - the number of slow and number of fast entries. + // |processingDelay| - the event duration we add on each event. + async function testDurationWithDurationThreshold(t, id, numEntries, durThreshold, processingDelay) { + assert_implements(window.PerformanceEventTiming, 'Event Timing is not supported.'); + const observerPromise = new Promise(async resolve => { + let minDuration = Math.ceil(durThreshold / 8) * 8; + // Exposed events must always have a minimum duration of 16. + minDuration = Math.max(minDuration, 16); + new PerformanceObserver(t.step_func(list => { + const pointerDowns = list.getEntriesByName('pointerdown'); + pointerDowns.forEach(p => { + assert_greater_than_equal(p.duration, minDuration, + "The entry's duration should be greater than or equal to " + minDuration + " ms."); + }); + resolve(); + })).observe({type: "event", durationThreshold: durThreshold}); + }); + for (let index = 0; index < numEntries; index++) { + // These clicks are expected to be ignored, unless the test has some extra delays. + // In that case, the test will verify the event duration to ensure the event duration is + // greater than the duration threshold + await clickOnElementAndDelay(id, processingDelay); + } + // Send click with event duration equals to or greater than |durThreshold|, so the + // observer promise can be resolved + await clickOnElementAndDelay(id, durThreshold); + return observerPromise; + } + +// Apply events that trigger an event of the given |eventType| to be dispatched to the +// |target|. Some of these assume that the target is not on the top left corner of the +// screen, which means that (0, 0) of the viewport is outside of the |target|. +function applyAction(eventType, target) { + const actions = new test_driver.Actions(); + if (eventType === 'auxclick') { + actions.pointerMove(0, 0, {origin: target}) + .pointerDown({button: actions.ButtonType.MIDDLE}) + .pointerUp({button: actions.ButtonType.MIDDLE}); + } else if (eventType === 'click' || eventType === 'mousedown' || eventType === 'mouseup' + || eventType === 'pointerdown' || eventType === 'pointerup' + || eventType === 'touchstart' || eventType === 'touchend') { + actions.pointerMove(0, 0, {origin: target}) + .pointerDown() + .pointerUp(); + } else if (eventType === 'contextmenu') { + actions.pointerMove(0, 0, {origin: target}) + .pointerDown({button: actions.ButtonType.RIGHT}) + .pointerUp({button: actions.ButtonType.RIGHT}); + } else if (eventType === 'dblclick') { + actions.pointerMove(0, 0, {origin: target}) + .pointerDown() + .pointerUp() + .pointerDown() + .pointerUp() + // Reset by clicking outside of the target. + .pointerMove(0, 0) + .pointerDown() + } else if (eventType === 'mouseenter' || eventType === 'mouseover' + || eventType === 'pointerenter' || eventType === 'pointerover') { + // Move outside of the target and then back inside. + // Moving it to 0, 1 because 0, 0 doesn't cause the pointer to + // move in Firefox. See https://github.com/w3c/webdriver/issues/1545 + actions.pointerMove(0, 1) + .pointerMove(0, 0, {origin: target}); + } else if (eventType === 'mouseleave' || eventType === 'mouseout' + || eventType === 'pointerleave' || eventType === 'pointerout') { + actions.pointerMove(0, 0, {origin: target}) + .pointerMove(0, 0); + } else if (eventType === 'keyup' || eventType === 'keydown') { + // Any key here as an input should work. + // TODO: Switch this to use test_driver.Actions.key{up,down} + // when test driver supports it. + // Please check crbug.com/893480. + const key = 'k'; + return test_driver.send_keys(target, key); + } else { + assert_unreached('The event type ' + eventType + ' is not supported.'); + } + return actions.send(); +} + +function requiresListener(eventType) { + return ['mouseenter', + 'mouseleave', + 'pointerdown', + 'pointerenter', + 'pointerleave', + 'pointerout', + 'pointerover', + 'pointerup', + 'keyup', + 'keydown' + ].includes(eventType); +} + +function notCancelable(eventType) { + return ['mouseenter', 'mouseleave', 'pointerenter', 'pointerleave'].includes(eventType); +} + +// Tests the given |eventType|'s performance.eventCounts value. Since this is populated only when +// the event is processed, we check every 10 ms until we've found the |expectedCount|. +function testCounts(t, resolve, looseCount, eventType, expectedCount) { + const counts = performance.eventCounts.get(eventType); + if (counts < expectedCount) { + t.step_timeout(() => { + testCounts(t, resolve, looseCount, eventType, expectedCount); + }, 10); + return; + } + if (looseCount) { + assert_greater_than_equal(performance.eventCounts.get(eventType), expectedCount, + `Should have at least ${expectedCount} ${eventType} events`) + } else { + assert_equals(performance.eventCounts.get(eventType), expectedCount, + `Should have ${expectedCount} ${eventType} events`); + } + resolve(); +} + +// Tests the given |eventType| by creating events whose target are the element with id +// 'target'. The test assumes that such element already exists. |looseCount| is set for +// eventTypes for which events would occur for other interactions other than the ones being +// specified for the target, so the counts could be larger. +async function testEventType(t, eventType, looseCount=false) { + assert_implements(window.EventCounts, "Event Counts isn't supported"); + const target = document.getElementById('target'); + if (requiresListener(eventType)) { + target.addEventListener(eventType, () =>{}); + } + const initialCount = performance.eventCounts.get(eventType); + if (!looseCount) { + assert_equals(initialCount, 0, 'No events yet.'); + } + // Trigger two 'fast' events of the type. + await applyAction(eventType, target); + await applyAction(eventType, target); + await waitForTick(); + await new Promise(t.step_func(resolve => { + testCounts(t, resolve, looseCount, eventType, initialCount + 2); + })); + // The durationThreshold used by the observer. A slow events needs to be slower than that. + const durationThreshold = 16; + // Now add an event handler to cause a slow event. + target.addEventListener(eventType, () => { + mainThreadBusy(durationThreshold + 4); + }); + const observerPromise = new Promise(async resolve => { + new PerformanceObserver(t.step_func(entryList => { + let eventTypeEntries = entryList.getEntriesByName(eventType); + if (eventTypeEntries.length === 0) + return; + + let entry = null; + if (!looseCount) { + entry = eventTypeEntries[0]; + assert_equals(eventTypeEntries.length, 1); + } else { + // The other events could also be considered slow. Find the one with the correct + // target. + eventTypeEntries.forEach(e => { + if (e.target === document.getElementById('target')) + entry = e; + }); + if (!entry) + return; + } + verifyEvent(entry, + eventType, + 'target', + false /* isFirst */, + durationThreshold, + notCancelable(eventType)); + // Shouldn't need async testing here since we already got the observer entry, but might as + // well reuse the method. + testCounts(t, resolve, looseCount, eventType, initialCount + 3); + })).observe({type: 'event', durationThreshold: durationThreshold}); + }); + // Cause a slow event. + await applyAction(eventType, target); + + await waitForTick(); + + await observerPromise; +} + +function addListeners(element, events) { + const clickHandler = (e) => { + mainThreadBusy(200); + }; + events.forEach(e => { element.addEventListener(e, clickHandler); }); +} + +// The testdriver.js, testdriver-vendor.js and testdriver-actions.js need to be +// included to use this function. +async function tap(element) { + return new test_driver.Actions() + .addPointer("touchPointer", "touch") + .pointerMove(0, 0, { origin: element }) + .pointerDown() + .pointerUp() + .send(); +} + +// The testdriver.js, testdriver-vendor.js need to be included to use this +// function. +async function pressKey(element, key) { + await test_driver.send_keys(element, key); +} + +// The testdriver.js, testdriver-vendor.js need to be included to use this +// function. +async function addListenersAndPress(element, key, events) { + addListeners(element, events); + return pressKey(element, key); +} + +// The testdriver.js, testdriver-vendor.js need to be included to use this +// function. +async function addListenersAndClick(element) { + addListeners(element, + ['mousedown', 'mouseup', 'pointerdown', 'pointerup', 'click']); + return test_driver.click(element); +} + +function filterAndAddToMap(events, map) { + return function (entry) { + if (events.includes(entry.name)) { + map.set(entry.name, entry.interactionId); + return true; + } + return false; + } +} + +async function createPerformanceObserverPromise(observeTypes, callback, readyToResolve +) { + return new Promise(resolve => { + new PerformanceObserver(entryList => { + callback(entryList); + + if (readyToResolve()) { + resolve(); + } + }).observe({ entryTypes: observeTypes }); + }); +} + +// The testdriver.js, testdriver-vendor.js need to be included to use this +// function. +async function interactAndObserve(interactionType, element, observerPromise) { + let interactionPromise; + switch (interactionType) { + case 'tap': { + addListeners(element, ['pointerdown', 'pointerup']); + interactionPromise = tap(element); + break; + } + case 'click': { + addListeners(element, + ['mousedown', 'mouseup', 'pointerdown', 'pointerup', 'click']); + interactionPromise = test_driver.click(element); + break; + } + } + return Promise.all([interactionPromise, observerPromise]); +} + +async function interact(interactionType, element, key = '') { + switch (interactionType) { + case 'click': { + return test_driver.click(element); + } + case 'tap': { + return tap(element); + } + case 'key': { + return test_driver.send_keys(element, key); + } + } +} + +async function verifyInteractionCount(t, expectedCount) { + await t.step_wait(() => { + return performance.interactionCount >= expectedCount; + }, 'interactionCount did not increase enough', 10000, 5); + assert_equals(performance.interactionCount, expectedCount, + 'interactionCount increased more than expected'); +} + +function interactionCount_test(interactionType, elements, key = '') { + return promise_test(async t => { + assert_implements(window.PerformanceEventTiming, + 'Event Timing is not supported'); + assert_equals(performance.interactionCount, 0, 'Initial count is not 0'); + + let expectedCount = 1; + for (let element of elements) { + await interact(interactionType, element, key); + await verifyInteractionCount(t, expectedCount++); + } + }, `EventTiming: verify interactionCount for ${interactionType} interaction`); +} diff --git a/testing/web-platform/tests/event-timing/resources/slow-image.py b/testing/web-platform/tests/event-timing/resources/slow-image.py new file mode 100644 index 0000000000..c2f91655cf --- /dev/null +++ b/testing/web-platform/tests/event-timing/resources/slow-image.py @@ -0,0 +1,7 @@ +import time + +def main(request, response): + # Sleep for 500ms to delay onload. + time.sleep(0.5) + response.headers.set(b"Cache-Control", b"no-cache, must-revalidate"); + response.headers.set(b"Location", b"data:image/gif;base64,R0lGODlhAQABAJAAAMjIyAAAACwAAAAAAQABAAACAgQBADs%3D"); diff --git a/testing/web-platform/tests/event-timing/retrievability.html b/testing/web-platform/tests/event-timing/retrievability.html new file mode 100644 index 0000000000..ab475fc529 --- /dev/null +++ b/testing/web-platform/tests/event-timing/retrievability.html @@ -0,0 +1,44 @@ + + + +Event Timing: make sure 'event' entries are not retrievable by performance.getEntries* APIs. + + + + + + + + + + + diff --git a/testing/web-platform/tests/event-timing/retrieve-firstInput.html b/testing/web-platform/tests/event-timing/retrieve-firstInput.html new file mode 100644 index 0000000000..c4536cb446 --- /dev/null +++ b/testing/web-platform/tests/event-timing/retrieve-firstInput.html @@ -0,0 +1,36 @@ + + + +Event Timing: first-input entry should be buffered even without observer + + + + + + + + + + diff --git a/testing/web-platform/tests/event-timing/shadow-dom-null-target.html b/testing/web-platform/tests/event-timing/shadow-dom-null-target.html new file mode 100644 index 0000000000..89587312c8 --- /dev/null +++ b/testing/web-platform/tests/event-timing/shadow-dom-null-target.html @@ -0,0 +1,69 @@ + + + + + + + + + + +
+
+ + + diff --git a/testing/web-platform/tests/event-timing/supported-types-consistent-with-self.html b/testing/web-platform/tests/event-timing/supported-types-consistent-with-self.html new file mode 100644 index 0000000000..b8a6876bf8 --- /dev/null +++ b/testing/web-platform/tests/event-timing/supported-types-consistent-with-self.html @@ -0,0 +1,19 @@ + + + +Event Timing: supportedEntryTypes should be consistent with `'PerformanceEventTiming' in Self` + + + + + diff --git a/testing/web-platform/tests/event-timing/supported-types.window.js b/testing/web-platform/tests/event-timing/supported-types.window.js new file mode 100644 index 0000000000..1cc43495c0 --- /dev/null +++ b/testing/web-platform/tests/event-timing/supported-types.window.js @@ -0,0 +1,12 @@ +test(() => { + assert_implements(window.PerformanceEventTiming, 'Event Timing is not supported.'); + assert_implements(typeof PerformanceObserver.supportedEntryTypes !== "undefined", + 'supportedEntryTypes is not supported'); + const types = PerformanceObserver.supportedEntryTypes; + assert_true(types.includes("first-input"), + "There should be 'first-input' in PerformanceObserver.supportedEntryTypes"); + assert_true(types.includes("event"), + "There should be 'event' in PerformanceObserver.supportedEntryTypes"); + assert_greater_than(types.indexOf("first-input"), types.indexOf('event'), + "The 'first-input' entry should appear after the 'event' entry"); +}, "supportedEntryTypes contains 'event' and 'first-input'."); diff --git a/testing/web-platform/tests/event-timing/timingconditions.html b/testing/web-platform/tests/event-timing/timingconditions.html new file mode 100644 index 0000000000..5f4448c2a1 --- /dev/null +++ b/testing/web-platform/tests/event-timing/timingconditions.html @@ -0,0 +1,69 @@ + + + +Event Timing only times certain types of trusted event. + + + + + + + + + + + diff --git a/testing/web-platform/tests/event-timing/toJSON.html b/testing/web-platform/tests/event-timing/toJSON.html new file mode 100644 index 0000000000..65e2782da3 --- /dev/null +++ b/testing/web-platform/tests/event-timing/toJSON.html @@ -0,0 +1,42 @@ + + +Event Timing: toJSON + + + + + + + + + -- cgit v1.2.3