Commit 0b6135a7 authored by Thomas Guilbert's avatar Thomas Guilbert Committed by Commit Bot

End tests via video.rAF

The video-frame-size-change.html is flaky because it sometimes finishes
before the pixels have rendered on screen. There are two reasons for
this:
1) We only wait on the second video to finish seeking to end the test.
2) Seeking doesn't guarantee that the frames will be painted on screen.

This CL fixes the issue by waiting for both videos to render on screen,
by using video.rAF calls to end the test as soon as both videos have
painted their frames.

Bug: 993671
Change-Id: I236777bf3fa83fc57e9e4e80560703965602d40c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2025581
Commit-Queue: Thomas Guilbert <tguilbert@chromium.org>
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Auto-Submit: Thomas Guilbert <tguilbert@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736965}
parent 8ee29c9a
......@@ -16,6 +16,12 @@
testRunner.waitUntilDone();
}
let numVideosRendered = 0;
function waitForRender(time, dict) {
if(++numVideosRendered == 2)
testRunner.notifyDone();
}
async function setupMse(video, contentType) {
let promise = new Promise((resolve, reject) => {
let mediaSource = new MediaSource();
......@@ -48,6 +54,7 @@
let singleSizeVideo = document.getElementById('single_size');
let ss_sourceBuffer = await setupMse(singleSizeVideo, 'video/webm; codecs="vp8"');
await appendBuffer(ss_sourceBuffer, videoData240p);
singleSizeVideo.requestAnimationFrame(waitForRender);
// Setup the second video with a single size for 1 second, followed by a larger size for 2 additional seconds.
let mixedSizeVideo = document.getElementById('mixed_size');
......@@ -57,14 +64,7 @@
await appendBuffer(ms_sourceBuffer, videoData480p);
// Seek the second video beyond the first size.
mixedSizeVideo.addEventListener('seeked', () => {
if (window.testRunner) {
// Make sure we render the seeked frame.
requestAnimationFrame(() => {
testRunner.notifyDone();
});
}
});
mixedSizeVideo.currentTime = 2;
mixedSizeVideo.requestAnimationFrame(waitForRender);
})();
</script>
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