blob: 707840671b16ba815dcd79f948ed02401bf999e8 [file] [log] [blame]
Nicolás Peña Moreno93ba8642019-06-20 15:52:051<!DOCTYPE HTML>
2<meta charset=utf-8>
3<title>Largest Contentful Paint: observe image.</title>
4<body>
5<script src="/resources/testharness.js"></script>
6<script src="/resources/testharnessreport.js"></script>
Nicolás Peña Moreno4ad4e602019-08-29 18:55:147<script src="resources/largest-contentful-paint-helpers.js"></script>
Nicolás Peña Moreno93ba8642019-06-20 15:52:058<script>
Nicolás Peña Moreno93ba8642019-06-20 15:52:059 async_test(function (t) {
Stephen McGruerb291cab2020-04-16 15:42:2810 assert_implements(window.LargestContentfulPaint, "LargestContentfulPaint is not implemented");
Nicolás Peña Moreno4ad4e602019-08-29 18:55:1411 const beforeLoad = performance.now();
Nicolás Peña Moreno93ba8642019-06-20 15:52:0512 const observer = new PerformanceObserver(
13 t.step_func_done(function(entryList) {
14 assert_equals(entryList.getEntries().length, 1);
15 const entry = entryList.getEntries()[0];
Nicolás Peña Moreno4ad4e602019-08-29 18:55:1416 const url = window.location.origin + '/images/blue.png';
17 // blue.png is 133 by 106.
18 const size = 133 * 106;
19 checkImage(entry, url, 'image_id', size, beforeLoad);
Nicolás Peña Moreno93ba8642019-06-20 15:52:0520 })
21 );
Nicolás Peña Morenof1a492a2019-07-04 15:09:3022 observer.observe({type: 'largest-contentful-paint', buffered: true});
Nicolás Peña Morenof7dbdc02019-07-02 16:39:1223 }, 'Same-origin image is observable.');
Nicolás Peña Moreno93ba8642019-06-20 15:52:0524</script>
25
Nicolás Peña Morenof7dbdc02019-07-02 16:39:1226<img src='/images/blue.png' id='image_id'/>
Nicolás Peña Moreno93ba8642019-06-20 15:52:0527</body>