Commit d5eff2fa authored by Nicolas Pena's avatar Nicolas Pena Committed by Commit Bot

Add paint-timing test for sibling frames

This CL adds a test to make sure that there are no paint entries when a
sibling frame paints an image.

Bug: 736114
Change-Id: Ie65dc1f3aea6d67f690164ba9007950eba7a5c6d
Reviewed-on: https://chromium-review.googlesource.com/769929
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Reviewed-by: default avatarTimothy Dresser <tdresser@chromium.org>
Cr-Commit-Position: refs/heads/master@{#519790}
parent 9199b4ed
......@@ -7,9 +7,9 @@
async_test(function (t) {
window.addEventListener('message', t.step_func(e => {
assert_equals(e.data, '2 paint first-paint paint first-contentful-paint');
const bufferedEntries = performance.getEntriesByType('paint');
// When only child frame paints, expect only first-paint.
t.step_timeout( function() {
const bufferedEntries = performance.getEntriesByType('paint');
assert_equals(bufferedEntries.length, 1);
assert_equals(bufferedEntries[0].entryType, 'paint');
assert_equals(bufferedEntries[0].name, 'first-paint');
......
<!DOCTYPE html>
<body>
<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>
<script>
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(e.data, '2 paint first-paint paint first-contentful-paint');
paintingIframeHasDispatchedEntries = true;
// Ask the listening iframe to send its paint-timing entries.
document.getElementById('listening-iframe').
contentWindow.postMessage('', '*');
return;
}
// Check the paint-timing entries from the listening iframe.
assert_equals(e.data, '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');
t.done();
}));
}, 'Frame ignores paint-timing events fired from sibling frame.');
</script>
<!-- This iframe is where all of the painting occurs. -->
<iframe id="painting-iframe" src="resources/subframe-painting.html"></iframe>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment