Deflake LoAf test: protect from spurious pointer events
Instead of failing test when UI event timing is wrong,
treat it as a non-matching entry so that the test can
be retried.
Bug: 1469164
Change-Id: I270efd34d9f27d8dafe36353e00e9b56f4446bd4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4889915
Commit-Queue: Noam Rosenthal <nrosenthal@chromium.org>
Reviewed-by: Annie Sullivan <sullivan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1200805}
diff --git a/long-animation-frame/tentative/loaf-first-ui-event.html b/long-animation-frame/tentative/loaf-first-ui-event.html
index 47a3a51..857ccd0 100644
--- a/long-animation-frame/tentative/loaf-first-ui-event.html
+++ b/long-animation-frame/tentative/loaf-first-ui-event.html
@@ -51,9 +51,9 @@
.pointerUp();
await actions.send();
await eventPromise;
- }, s => s.name === "BUTTON.onpointermove", t);
- const [entry] = await entryPromise;
- assert_equals(entry.firstUIEventTimestamp, expectedTimestamp);
+ }, (script, entry) =>
+ script.name === "BUTTON.onpointermove" &&
+ entry.firstUIEventTimestamp === expectedTimestamp, t);
}, "LoAF should expose firstUIEventTimestamp for pointermove events");
promise_test(async t => {
diff --git a/long-animation-frame/tentative/resources/utils.js b/long-animation-frame/tentative/resources/utils.js
index a60afb6..574af6d 100644
--- a/long-animation-frame/tentative/resources/utils.js
+++ b/long-animation-frame/tentative/resources/utils.js
@@ -49,7 +49,7 @@
if (entry === "timeout" || !entry.scripts.length)
continue;
for (const script of entry.scripts) {
- if (predicate(script))
+ if (predicate(script, entry))
return [entry, script];
}
}