cross-origin-image.sub.html (1183B)
1 <!DOCTYPE HTML> 2 <meta charset=utf-8> 3 <title>Largest Contentful Paint: observe cross-origin images but without renderTime.</title> 4 <body> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="resources/largest-contentful-paint-helpers.js"></script> 8 <script> 9 async_test(function (t) { 10 assert_implements(window.LargestContentfulPaint, "LargestContentfulPaint is not implemented"); 11 const beforeLoad = performance.now(); 12 const observer = new PerformanceObserver( 13 t.step_func_done(function(entryList) { 14 assert_equals(entryList.getEntries().length, 1); 15 const entry = entryList.getEntries()[0]; 16 const url = 'http://{{domains[www]}}:{{ports[http][1]}}/images/blue.png'; 17 // blue.png is 133 x 106. 18 const size = 133 * 106; 19 checkImage(entry, url, 'image_id', size, beforeLoad, ['renderTimeIs0']); 20 }) 21 ); 22 observer.observe({type: 'largest-contentful-paint', buffered: true}); 23 }, 'Cross-origin image is observable, with renderTime equal to 0.'); 24 </script> 25 26 <img src='http://{{domains[www]}}:{{ports[http][1]}}/images/blue.png' id='image_id'/> 27 </body>