| Nicolas Pena | aa02ad5 | 2017-09-08 18:21:36 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <head> |
| 3 | <title>Performance Paint Timing Test: FCP due to background image</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 | </body> |
| 10 | |
| 11 | <footer> |
| 12 | <script> |
| 13 | async_test(function (t) { |
| Stephen McGruer | f3bf3bb | 2020-04-16 13:44:59 | [diff] [blame] | 14 | assert_implements(window.PerformancePaintTiming, "Paint Timing isn't supported."); |
| Nicolas Pena | aa02ad5 | 2017-09-08 18:21:36 | [diff] [blame] | 15 | const body = document.getElementsByTagName('body')[0]; |
| 16 | body.style.backgroundImage = 'url(resources/circles.png)'; |
| 17 | window.onload = function() { |
| 18 | function testPaintEntries() { |
| 19 | const bufferedEntries = performance.getEntriesByType('paint'); |
| 20 | if (bufferedEntries.length < 2) { |
| 21 | t.step_timeout(function() { |
| 22 | testPaintEntries(); |
| 23 | }, 20); |
| 24 | return; |
| 25 | } |
| 26 | t.step(function() { |
| 27 | assert_equals(bufferedEntries.length, 2, "There should be two paint timing instances."); |
| 28 | assert_equals(bufferedEntries[0].entryType, "paint"); |
| 29 | assert_equals(bufferedEntries[0].name, "first-paint"); |
| 30 | assert_equals(bufferedEntries[1].entryType, "paint"); |
| 31 | assert_equals(bufferedEntries[1].name, "first-contentful-paint"); |
| 32 | t.done(); |
| 33 | }); |
| 34 | } |
| 35 | t.step(function() { |
| 36 | testPaintEntries(); |
| 37 | }); |
| 38 | }; |
| 39 | }, "First contentful paint fires due to background image render."); |
| 40 | </script> |
| 41 | <footer> |
| 42 | </html> |