containertiming-observe-after-paint-without-buffering.html (1419B)
1 <!DOCTYPE HTML> 2 <meta charset=utf-8> 3 <title>Container Timing: observe after painting happened without buffering</title> 4 <body> 5 <style> 6 body { 7 margin: 0; 8 } 9 </style> 10 <script src="/resources/testharness.js"></script> 11 <script src="/resources/testharnessreport.js"></script> 12 <script src="/container-timing/resources/container-timing-helpers.js"></script> 13 <script src="/element-timing/resources/element-timing-helpers.js"></script> 14 <script> 15 async_test(function (t) { 16 assert_implements(window.PerformanceContainerTiming, "PerformanceContainerTiming is not implemented"); 17 18 onElementTimingEvent(()=> { 19 const observer = new PerformanceObserver( 20 t.step_func_done(function (entryList) { 21 assert_unreached("Painting happened before observing, it should not create a containertiming entry"); 22 }) 23 ); 24 observer.observe({ type: 'container', buffered: false }); 25 t.step_timeout(() => { t.done(); }, 1000); 26 }); 27 28 // Add image of width equal to 100 and height equal to 100. 29 const img = document.createElement('img'); 30 img.src = '/container-timing/resources/square100.png'; 31 img.setAttribute('containertiming', 'image_ct'); 32 img.setAttribute('id', 'my_id'); 33 document.body.appendChild(img); 34 35 addPaintingElementTimingAfterDoubleRAF(document.body); 36 }, 'containertiming does not report paints before observing if buffering is disabled.'); 37 </script> 38 39 </body>