From 0e1d2705ba55d2dd1fc9b3291371ebbc1027e3ba Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Mon, 6 Mar 2023 13:58:52 +0000 Subject: [PATCH] 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 Reviewed-by: Yoav Weiss Cr-Commit-Position: refs/heads/main@{#1112110} -- wpt-commits: a84d334b31f3a59020be7ee164e504ab0c44f7e6 wpt-pr: 38783 --- .../tentative/loaf-buffered.html | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/testing/web-platform/tests/long-animation-frame/tentative/loaf-buffered.html b/testing/web-platform/tests/long-animation-frame/tentative/loaf-buffered.html index c7ede8418f3d1..9956aeda93dab 100644 --- a/testing/web-platform/tests/long-animation-frame/tentative/loaf-buffered.html +++ b/testing/web-platform/tests/long-animation-frame/tentative/loaf-buffered.html @@ -13,13 +13,16 @@

Long Animation Frame: buffered

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.');