| Nicolas Pena | aa02ad5 | 2017-09-08 18:21:36 | [diff] [blame] | 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 | async_test(function (t) { |
| 12 | const div = document.createElement("div"); |
| 13 | div.style.width = "100px"; |
| 14 | div.style.height = "100px"; |
| 15 | div.style.backgroundColor = "red"; |
| 16 | div.style.color = "blue"; |
| 17 | document.getElementById("main").appendChild(div); |
| 18 | |
| 19 | function testPaintEntries() { |
| 20 | const bufferedEntries = performance.getEntriesByType('paint'); |
| 21 | if (bufferedEntries.length < 1) { |
| 22 | t.step_timeout(function() { |
| 23 | testPaintEntries(); |
| 24 | }, 20); |
| 25 | return; |
| 26 | } |
| 27 | t.step(function() { |
| 28 | assert_equals(bufferedEntries.length, 1, "FP only."); |
| 29 | assert_equals(bufferedEntries[0].entryType, "paint"); |
| 30 | assert_equals(bufferedEntries[0].name, "first-paint"); |
| 31 | t.done(); |
| 32 | }); |
| 33 | } |
| 34 | t.step(function() { |
| 35 | testPaintEntries(); |
| 36 | }) |
| 37 | }, "Performance first paint timing entry exists. No first contentful paint."); |
| 38 | </script> |
| 39 | </body> |
| 40 | </html> |