expanded-image.html (1329B)
1 <!DOCTYPE HTML> 2 <meta charset=utf-8> 3 <title>Largest Contentful Paint: expanded image bounded by intrinsic size.</title> 4 <style type="text/css"> 5 #image_id { 6 width: 300px; 7 height: 300px; 8 } 9 </style> 10 <body> 11 <script src="/resources/testharness.js"></script> 12 <script src="/resources/testharnessreport.js"></script> 13 <script src="resources/largest-contentful-paint-helpers.js"></script> 14 <script> 15 setup({"hide_test_state": true}); 16 async_test(function (t) { 17 assert_implements(window.LargestContentfulPaint, "LargestContentfulPaint is not implemented"); 18 const beforeLoad = performance.now(); 19 const observer = new PerformanceObserver( 20 t.step_func_done(function(entryList) { 21 assert_equals(entryList.getEntries().length, 1); 22 const entry = entryList.getEntries()[0]; 23 const url = window.location.origin + '/images/black-rectangle.png'; 24 // black-rectangle.png is 100 x 50. It occupies 300 x 300 so size will be bounded by the intrinsic size. 25 const size = 100 * 50; 26 checkImage(entry, url, 'image_id', size, beforeLoad); 27 }) 28 ); 29 observer.observe({type: 'largest-contentful-paint', buffered: true}); 30 }, 'Largest Contentful Paint: |size| attribute is bounded by intrinsic size.'); 31 </script> 32 <img src='/images/black-rectangle.png' id='image_id'/> 33 </body>