test_performance_paint_observer_helper.html (1243B)
1 <!-- 2 Any copyright is dedicated to the Public Domain. 3 http://creativecommons.org/publicdomain/zero/1.0/ 4 --> 5 <!DOCTYPE html> 6 <html> 7 <body> 8 </body> 9 <script> 10 var promise = new Promise(resolve => { 11 var observer = new PerformanceObserver(list => resolve(list)); 12 observer.observe({entryTypes: ["paint"]}); 13 }); 14 15 promise.then(list => { 16 var perfEntries = list.getEntries(); 17 opener.is(list.getEntries().length, 1); 18 opener.isDeeply(list.getEntries(), 19 performance.getEntriesByType("paint"), 20 "Observed 'paint' entries should equal to entries obtained by getEntriesByType."); 21 opener.isDeeply(list.getEntries({name: "paint"}), 22 performance.getEntriesByName("paint"), 23 "getEntries with name filter should return correct results."); 24 opener.isDeeply(list.getEntries({entryType: "paint"}), 25 performance.getEntriesByType("paint"), 26 "getEntries with entryType filter should return correct results."); 27 opener.done(); 28 }); 29 30 const img = document.createElement("IMG"); 31 img.src = "http://example.org/tests/dom/performance/tests/logo.png"; 32 document.body.appendChild(img); 33 34 </script> 35 </html>