first-paint-only.html (1303B)
1 <!DOCTYPE html> 2 <head> 3 <title>Performance Paint Timing Test: FP only</title> 4 </head> 5 <body> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <div id="main"></div> 9 10 <script> 11 setup({"hide_test_state": true}); 12 async_test(function (t) { 13 assert_implements(window.PerformancePaintTiming, "Paint Timing isn't supported."); 14 const div = document.createElement("div"); 15 div.style.width = "100px"; 16 div.style.height = "100px"; 17 div.style.backgroundColor = "red"; 18 div.style.color = "blue"; 19 document.getElementById("main").appendChild(div); 20 21 function testPaintEntries() { 22 const bufferedEntries = performance.getEntriesByType('paint'); 23 if (bufferedEntries.length < 1) { 24 t.step_timeout(function() { 25 testPaintEntries(); 26 }, 20); 27 return; 28 } 29 t.step(function() { 30 assert_equals(bufferedEntries.length, 1, "FP only."); 31 assert_equals(bufferedEntries[0].entryType, "paint"); 32 assert_equals(bufferedEntries[0].name, "first-paint"); 33 t.done(); 34 }); 35 } 36 t.step(function() { 37 testPaintEntries(); 38 }) 39 }, "Performance first paint timing entry exists. No first contentful paint."); 40 </script> 41 </body> 42 </html>