forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirst-paint-bg-color.html
37 lines (35 loc) · 1019 Bytes
/
first-paint-bg-color.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE html>
<head>
<title>Performance Paint Timing Test: FP due to background color</title>
</head>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="main"></div>
</body>
<footer>
<script>
async_test(function (t) {
document.body.style.backgroundColor = "#AA0000";
function testPaintEntries() {
const bufferedEntries = performance.getEntriesByType('paint');
if (bufferedEntries.length < 1) {
t.step_timeout(function() {
testPaintEntries();
}, 20);
return;
}
t.step(function() {
assert_equals(bufferedEntries.length, 1, "FP should fire for background color, not FCP");
assert_equals(bufferedEntries[0].entryType, "paint");
assert_equals(bufferedEntries[0].name, "first-paint");
t.done();
});
}
t.step(function() {
testPaintEntries();
})
}, "First paint fires due to background color. No FCP");
</script>
<footer>
</html>