Skip to content

Commit

Permalink
Unflake loaf test
Browse files Browse the repository at this point in the history
- 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}
  • Loading branch information
noamr authored and chromium-wpt-export-bot committed Mar 2, 2023
1 parent ee6c350 commit a84d334
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions long-animation-frame/tentative/loaf-buffered.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ <h1>Long Animation Frame: buffered</h1>
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>

0 comments on commit a84d334

Please sign in to comment.