blob: d4197e8a35c444401b0a7dc84f0fc5a279193ca0 [file] [log] [blame]
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!-- This iframe will have a sibling that paints, we want to ensure it does not detect that paint. -->
<iframe id="listening-iframe" src="resources/subframe-sending-paint.html"></iframe>
async_test(function (t) {
let paintingIframeHasDispatchedEntries = false;
window.addEventListener('message', t.step_func(e => {
if (!paintingIframeHasDispatchedEntries) {
// Check paint-timing entries from the painting iframe.
assert_equals(, '2 paint first-paint paint first-contentful-paint');
paintingIframeHasDispatchedEntries = true;
// Ask the listening iframe to send its paint-timing entries.
contentWindow.postMessage('', '*');
// Check the paint-timing entries from the listening iframe.
assert_equals(, '0');
// Check that current frame receives first-paint but not first-contentful-paint.
const bufferedEntries = performance.getEntriesByType('paint');
assert_equals(bufferedEntries.length, 1);
assert_equals(bufferedEntries[0].entryType, 'paint');
assert_equals(bufferedEntries[0].name, 'first-paint');
}, 'Frame ignores paint-timing events fired from sibling frame.');
<!-- This iframe is where all of the painting occurs. -->
<iframe id="painting-iframe" src="resources/subframe-painting.html"></iframe>