Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE HTML>
<meta charset=utf-8>
<title>Container Timing: observe with a node with containertiming and a video poster child</title>
<body>
<style>
body {
margin: 0;
}
</style>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/container-timing/resources/container-timing-helpers.js"></script>
<script>
let beforeRender;
async_test(function (t) {
assert_implements(window.PerformanceContainerTiming, "PerformanceContainerTiming is not implemented");
const observer = new PerformanceObserver(
t.step_func_done(function(entryList) {
assert_equals(entryList.getEntries().length, 1);
const entry = entryList.getEntries()[0];
checkContainerEntry(entry, 'div_ct', 'video_id', beforeRender);
assert_greater_than(entry.size, 0, 'size should be greater than 0');
})
);
observer.observe({entryTypes: ['container']});
// Add a div that is the container timing root
const div = document.createElement('div');
div.setAttribute('containertiming', 'div_ct');
document.body.appendChild(div);
// Add video element with poster image (for reliable testing without actual playback)
const video = document.createElement('video');
video.setAttribute('id', 'video_id');
video.poster = '/container-timing/resources/square100.png';
video.width = 100;
video.height = 100;
div.appendChild(video);
beforeRender = performance.now();
}, 'Paint of the video poster child of container timing is reported.');
</script>
</body>