Skip to content

Commit

Permalink
Another speculative fix for flaky touch WPT
Browse files Browse the repository at this point in the history
Per the history[1], the fix in crrev.com/c/6149989 does not appear to
have succeeded. This patch makes another attempt borrowing logic from
waitForCompositorReady which has stronger implications about the
readiness of the compositor thread than waitForCompostiorCommit which
crrev.com/c/6149989 was based on.

[1] https://ci.chromium.org/ui/test/chromium/ninja%3A%2F%2F%3Aheadless_shell_wpt%2Fexternal%2Fwpt%2Ftouch-events%2Fsingle-touch.html?q=V%3Abuilder%3DLinux%2520Tests+V%3Aos%3DUbuntu-22.04+V%3Atest_suite%3Dheadless_shell_wpt_tests

R=mustaq@chromium.org

Bug: 385526611
Change-Id: I52bbd8023fe50c7076890efedf7caddbdfaa330c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6164303
Commit-Queue: David Awogbemila <awogbemila@chromium.org>
Reviewed-by: Mustaq Ahmed <mustaq@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1404305}
  • Loading branch information
David Awogbemila authored and chromium-wpt-export-bot committed Jan 9, 2025
1 parent 409679c commit 0c50f7d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
9 changes: 4 additions & 5 deletions touch-events/single-touch.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="support/touch.js"></script>


<script>
// Check a Touch object's attributes for existence and correct type
Expand Down Expand Up @@ -332,11 +334,8 @@
}

async function run() {
// Some user-agents require a brief waiting period before input can be
// processed correctly.
await new Promise(resolve => {
requestAnimationFrame(() => requestAnimationFrame(resolve));
});
await waitTillReadyForTouchInput();

const target0 = document.getElementById("target0");
const target1 = document.getElementById("target1");
const doneButton = document.getElementById('done');
Expand Down
11 changes: 11 additions & 0 deletions touch-events/support/touch.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,14 @@ function check_TouchEvent(ev) {
}
});
}

// This chromium-specific helper is a no-op to other user-agents. It can be used
// to ensure that chromium's input-handling compositor thread is ready before
// touch-related test logic proceeds.
// TODO(crbug.com/41481669): This shouldn't be necessary if the test harness
// deferred running the tests until after paint holding.
async function waitTillReadyForTouchInput() {
const animation =
document.body.animate({ opacity: [ 0, 1 ] }, {duration: 1 });
return animation.finished;
}

0 comments on commit 0c50f7d

Please sign in to comment.