diff options
Diffstat (limited to 'testing/web-platform/tests/paint-timing/with-first-paint/first-paint-bg-color.html')
-rw-r--r-- | testing/web-platform/tests/paint-timing/with-first-paint/first-paint-bg-color.html | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/testing/web-platform/tests/paint-timing/with-first-paint/first-paint-bg-color.html b/testing/web-platform/tests/paint-timing/with-first-paint/first-paint-bg-color.html new file mode 100644 index 0000000000..a4f799045f --- /dev/null +++ b/testing/web-platform/tests/paint-timing/with-first-paint/first-paint-bg-color.html @@ -0,0 +1,39 @@ +<!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> +setup({"hide_test_state": true}); +async_test(function (t) { + assert_implements(window.PerformancePaintTiming, "Paint Timing isn't supported."); + 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> |