Bug 1864552 [wpt PR 43131] - Fix recent-input.html Flaky Test, a=testonly
commitd20d7cf57f6df36367e8aaad94ce29f61d47ea58
authorBlink WPT Bot <blink-w3c-test-autoroller@chromium.org>
Mon, 20 Nov 2023 11:07:24 +0000 (20 11:07 +0000)
committermoz-wptsync-bot <wptsync@mozilla.com>
Wed, 22 Nov 2023 12:51:11 +0000 (22 12:51 +0000)
tree2a26df7da8e34c116b8e236780a87932332d49e7
parent833b25b5154db5adefad7b408343364342c78c50
Bug 1864552 [wpt PR 43131] - Fix recent-input.html Flaky Test, a=testonly

Automatic update from web-platform-tests
Fix recent-input.html Flaky Test (#43131)

- Fix the flakiness
- Refactor/flatten the test for better readability
- Rename clickHandler to pointerdownHandler

Previous Undesired Outcome:
- assert_greater_than_equal(timeAfterClick, entry.lastInputTime)
  sometimes fail.

Root Cause:
- The variable timeAfterClick is really a time after pointerdown and can
  possibly happen before the click event processingStart.
- LastInputTime is the timestamp of the event comes in. And when a new
  event show up later, it will get refreshed.
- Thus, if we try to compare pointdown's processingEnd with
  lastInputTime of (for example) click event, then there's no guarantee
  of one is greater the other.

This CL address it by:
- Remove timeAfterClick, which is not a very meaningful timestamp, since
  we should never assume no more events coming in after.
- Compare lastInputTime with the layout shift startTime instead, for
  which the sequence is always guaranteed.

Bug: 1441125
Change-Id: Id5fd368db78afd16df4b2a1e7b8924b32fa6a0f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5026199
Reviewed-by: Michal Mocny <mmocny@chromium.org>
Commit-Queue: Aoyuan Zuo <zuoaoyuan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1224360}

Co-authored-by: Aoyuan Zuo <zuoaoyuan@chromium.org>
--

wpt-commits: 7ef6f100d2d30b7dcc7e5e0d7cb543883f98ad6f
wpt-pr: 43131
testing/web-platform/tests/event-timing/resources/event-timing-test-utils.js
testing/web-platform/tests/layout-instability/recent-input.html