blob: 3da3d2553ee81d65c2b9540d49f8ac8352d41e8d [file] [log] [blame]
Nicolas Penaaa02ad52017-09-08 18:21:361<!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>
13async_test(function (t) {
Stephen McGruerf3bf3bb2020-04-16 13:44:5914 assert_implements(window.PerformancePaintTiming, "Paint Timing isn't supported.");
Nicolas Penaaa02ad52017-09-08 18:21:3615 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>