Skip to content

Commit

Permalink
Report first frame of animated image as LCP render time. (web-platfor…
Browse files Browse the repository at this point in the history
…m-tests#49402)

Change-Id: If9df1402752265539fc82ae1b9ab356a7c1fceb3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6038997
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Commit-Queue: Ian Clelland <iclelland@chromium.org>
Reviewed-by: Annie Sullivan <sullivan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1388807}

Co-authored-by: Ian Clelland <iclelland@chromium.org>
  • Loading branch information
chromium-wpt-export-bot and clelland authored Dec 2, 2024
1 parent cffaa02 commit 54c7d21
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
const entry = await load_and_observe(url);
// anim-gr.png is 100 by 50.
const size = 100 * 50;
checkImage(entry, url, 'image_id', size, beforeLoad, ["renderTimeIs0", "animated-zero"]);
checkImage(entry, url, 'image_id', size, beforeLoad, ["animated"]);
}, "Same origin animated image is observable and has a first frame.");
</script>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ function checkImage(entry, expectedUrl, expectedID, expectedSize, timeLowerBound
if (options.includes('skip')) {
return;
}
assert_between_inclusive(entry.loadTime, timeLowerBound, entry.renderTime,
'loadTime should occur between the lower bound and the renderTime');
assert_greater_than_equal(performance.now(), entry.renderTime,
'renderTime should occur before the entry is dispatched to the observer.');
assert_approx_equals(entry.startTime, entry.renderTime, 0.001,
Expand All @@ -55,14 +53,14 @@ function checkImage(entry, expectedUrl, expectedID, expectedSize, timeLowerBound
}

if (options.includes('animated')) {
assert_greater_than(entry.loadTime, entry.firstAnimatedFrameTime,
'firstAnimatedFrameTime should be smaller than loadTime');
assert_greater_than(entry.renderTime, entry.firstAnimatedFrameTime,
'firstAnimatedFrameTime should be smaller than renderTime');
assert_less_than(entry.firstAnimatedFrameTime, image_delay,
'firstAnimatedFrameTime should be smaller than the delay applied to the second frame');
assert_greater_than(entry.firstAnimatedFrameTime, 0,
'firstAnimatedFrameTime should be larger than 0');
assert_less_than(entry.renderTime, image_delay,
'renderTime should be smaller than the delay applied to the second frame');
assert_greater_than(entry.renderTime, 0,
'renderTime should be larger than 0');
}
else {
assert_between_inclusive(entry.loadTime, timeLowerBound, entry.renderTime,
'loadTime should occur between the lower bound and the renderTime');
}
}

Expand Down

0 comments on commit 54c7d21

Please sign in to comment.