blob: ed6adfb2c7c66c65bd13f514be173d1cb48ff19e [file] [log] [blame]
Nicolás Peña Morenob26c53a2019-07-19 00:15:451<!DOCTYPE HTML>
2<meta charset=utf-8>
3<title>Largest Contentful Paint: contracted image bounded by display size.</title>
4<style type="text/css">
5 #image_id {
6 width: 50px;
7 height: 50px;
8 }
9</style>
10<body>
11<script src="/resources/testharness.js"></script>
12<script src="/resources/testharnessreport.js"></script>
Nicolás Peña Moreno4ad4e602019-08-29 18:55:1413<script src="resources/largest-contentful-paint-helpers.js"></script>
Nicolás Peña Morenob26c53a2019-07-19 00:15:4514<script>
15 async_test(function (t) {
Nicolás Peña Morenobd2c0492020-01-23 16:37:2516 assert_precondition(window.LargestContentfulPaint, "LargestContentfulPaint is not implemented");
Nicolás Peña Moreno4ad4e602019-08-29 18:55:1417 const beforeLoad = performance.now();
Nicolás Peña Morenob26c53a2019-07-19 00:15:4518 const observer = new PerformanceObserver(
19 t.step_func_done(function(entryList) {
20 assert_equals(entryList.getEntries().length, 1);
21 const entry = entryList.getEntries()[0];
Nicolás Peña Moreno4ad4e602019-08-29 18:55:1422 const url = window.location.origin + '/images/black-rectangle.png';
Nicolás Peña Morenob26c53a2019-07-19 00:15:4523 // black-rectangle.png is 100 x 50. It occupies 50 x 50 so size will be bounded by the displayed size.
Nicolás Peña Moreno4ad4e602019-08-29 18:55:1424 const size = 50 * 50;
25 checkImage(entry, url, 'image_id', size, beforeLoad);
Nicolás Peña Morenob26c53a2019-07-19 00:15:4526 })
27 );
28 observer.observe({type: 'largest-contentful-paint', buffered: true});
29 }, 'Largest Contentful Paint: |size| attribute is bounded by display size.');
30</script>
31<img src='/images/black-rectangle.png' id='image_id'/>
32</body>