Bug 1564652 [wpt PR 17528] - [LargestContentfulPaint] Fix flaky test observe-image.html, a=testonly

Automatic update from web-platform-tests
[LargestContentfulPaint] Fix flaky test observe-image.html

The timestamp captured at onload does not seem to always be smaller than
the render timestamp. This CL changes the lower bound so the test is no
longer flaky.

Bug: 978587
Change-Id: I48c058ac0abb684cb4406617500356d0aae019e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1678836
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Reviewed-by: Yoav Weiss <yoavweiss@chromium.org>
Cr-Commit-Position: refs/heads/master@{#672691}

--

wpt-commits: 0a02aa2599f1914a56b8557f29ec579ca5e6e701
wpt-pr: 17528
This commit is contained in:
Nicolás Peña Moreno 2019-07-19 18:15:37 +00:00 коммит произвёл James Graham
Родитель 01061990f6
Коммит c8a6987366
1 изменённых файлов: 6 добавлений и 7 удалений

Просмотреть файл

@ -5,21 +5,20 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
let beforeRender;
function computeTimestamp() {
beforeRender = performance.now();
}
async_test(function (t) {
if (!window.LargestContentfulPaint) {
assert_unreached("LargestContentfulPaint is not implemented");
}
let beforeRender = performance.now();
const observer = new PerformanceObserver(
t.step_func_done(function(entryList) {
assert_equals(entryList.getEntries().length, 1);
const entry = entryList.getEntries()[0];
assert_equals(entry.entryType, 'largestContentfulPaint');
assert_greater_than_equal(entry.startTime, beforeRender);
assert_greater_than_equal(performance.now(), entry.startTime);
assert_greater_than_equal(entry.startTime, beforeRender,
'The rendering timestamp should occur after script starts running.');
assert_greater_than_equal(performance.now(), entry.startTime,
'The rendering timestamp should occur before the entry is dispatched to the observer.');
assert_equals(entry.duration, 0);
// blue.png is 133 x 106.
assert_equals(entry.size, 14098);
@ -29,5 +28,5 @@
}, 'Element with elementtiming attribute is observable.');
</script>
<img src='/images/blue.png' onload='computeTimestamp()'/>
<img src='/images/blue.png'/>
</body>