Commit 2c337159 authored by Thomas Guilbert's avatar Thomas Guilbert Committed by Commit Bot

Deflake video-aspect-ratio.html

The test can end before the video's first frames are painted. This CL
attempts to fix the issue by making sure we have a frame per video
before ending.

Bug: 963141
Change-Id: Iccc9f771f4e7e366914b00b3a6004a08cf9829b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2225372
Commit-Queue: Thomas Guilbert <tguilbert@chromium.org>
Reviewed-by: default avatarTommy Steimel <steimel@chromium.org>
Auto-Submit: Thomas Guilbert <tguilbert@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827015}
parent d639d252
<script src="media-file.js"></script>
<script src="video-paint-test.js"></script>
<body onload="setSrcByTagName('video', 'content/test.ogv'); init()">
<body onload="setVideoSrcAndWaitForFirstFrame('content/test.ogv')">
<p>Test video sizing. You should see one bigger image (paused video) and 7 small ones of 1/4 its size. </p>
<video></video><br>
<video style="width: 160px; height:120px">
......
......@@ -7,6 +7,29 @@ function waitForMultipleEvents(name, times, func) {
}, true);
}
function waitForAllCallbacks(callCount, func) {
var rvfc_calls = 0;
return function() {
if(++rvfc_calls == callCount) {
func();
}
}
}
function setVideoSrcAndWaitForFirstFrame(src) {
var videos = document.getElementsByTagName('video');
var endTestCallback = waitForAllCallbacks(videos.length, () => {
if (window.testRunner)
testRunner.notifyDone();
});
for (var i = 0; i < videos.length; ++i) {
videos[i].requestVideoFrameCallback(endTestCallback);
videos[i].src = src;
}
}
function init()
{
var videos = document.getElementsByTagName('video');
......
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