Bug 1819854 [wpt PR 38783] - Unflake loaf test, a=testonly

Automatic update from web-platform-tests
Unflake loaf test

- loaf-buffered test: don't assume that the first LoAF entry is
the one we injected.

Bug: 1420756
Change-Id: Id9ba50d0b24b3cfa42c21f01fb45a5c808700352
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4302731
Commit-Queue: Noam Rosenthal <nrosenthal@chromium.org>
Reviewed-by: Yoav Weiss <yoavweiss@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1112110}

--

wpt-commits: a84d334b31f3a59020be7ee164e504ab0c44f7e6
wpt-pr: 38783
This commit is contained in:
Noam Rosenthal 2023-03-06 13:58:52 +00:00 committed by moz-wptsync-bot
parent 022d3c99c8
commit 4e48b05273

View File

@ -13,13 +13,16 @@
promise_test(async t => {
busy_wait(very_long_frame_duration);
await new Promise(resolve => t.step_timeout(resolve, 0));
const entry = await new Promise(resolve => {
new PerformanceObserver(t.step_func((entryList) => {
const entry = entryList.getEntries()[0];
if (entry.duration >= very_long_frame_duration)
resolve(entry);
const result = await new Promise(resolve => {
new PerformanceObserver(t.step_func(entries => {
for (const e of entries.getEntries()) {
if (e.duration >= very_long_frame_duration)
resolve("entry-found");
}
})).observe({type: 'long-animation-frame', buffered: true});
t.step_timeout(() => resolve("timeout"), no_long_frame_timeout);
});
assert_equals(result, "entry-found");
}, 'PerformanceObserver with buffered flag can see previous long-animation-frame entries.');
</script>
</body>