Bug 1374183 - Add a reftest to verify seeking to 0.466667 of street.mp4 should be the 15th frame. r=alwu

MozReview-Commit-ID: GdykZYs7wAq

--HG--
extra : rebase_source : 7fb1a4dd6a0f76748a204c45ace79ece1cb04d7e
This commit is contained in:
bechen 2017-07-25 10:41:41 +08:00
Родитель 58b1113fb9
Коммит 3951cf16d2
4 изменённых файлов: 52 добавлений и 2 удалений

Просмотреть файл

@ -23,7 +23,8 @@ or using nightly, the seekToNextFrame() ensure the ended event fired.
*/
//window.onload = function() { setTimeout(dumpFirstFrame, 0); };
window.onload = function() { setTimeout(dumpLastFrame, 0); };
//window.onload = function() { setTimeout(dumpLastFrame, 0); };
window.onload = function() { setTimeout(function(){dumpNthFrame(15);}, 0); };
function drawVideoToInnerHTML(v) {
var canvas = document.getElementById("canvas");
@ -44,6 +45,24 @@ function dumpFirstFrame() {
});
}
function dumpNthFrame(n) {
var video = document.getElementById("v1");
video.src = "street.mp4";
video.preload = "metadata";
function checkNthFrame() {
console.log(n+"th Frame time is " + video.currentTime);
n--;
if (n == 0) {
drawVideoToInnerHTML(video);
} else {
video.seekToNextFrame();
}
}
video.addEventListener("loadeddata", checkNthFrame);
video.addEventListener("seeked", checkNthFrame);
}
function dumpLastFrame() {
var video = document.getElementById("v1");
video.src = "short.mp4";

Просмотреть файл

@ -1,3 +1,4 @@
skip-if(Android) fuzzy-if(OSX,22,49977) skip-if(winWidget) fuzzy-if(webrender,70,600) HTTP(..) == short.mp4.firstframe.html short.mp4.firstframe-ref.html
skip-if(Android) fuzzy-if(OSX,23,51392) fuzzy-if(winWidget,59,76797) fuzzy-if(webrender,60,1800) HTTP(..) == short.mp4.lastframe.html short.mp4.lastframe-ref.html
skip-if(Android) skip-if(winWidget) fuzzy-if(webrender,55,4281) fuzzy-if(OSX,3,111852) HTTP(..) == bipbop_300_215kbps.mp4.lastframe.html bipbop_300_215kbps.mp4.lastframe-ref.html
skip-if(Android) skip-if(winWidget) fuzzy-if(webrender,55,4281) fuzzy-if(OSX,3,111852) HTTP(..) == bipbop_300_215kbps.mp4.lastframe.html bipbop_300_215kbps.mp4.lastframe-ref.html
skip-if(Android) skip-if(winWidget) fuzzy-if(OSX,2,213266) fuzzy-if(webrender,60,165174) HTTP(..) == street.mp4.seek.html street.mp4.15thframe-ref.html

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -0,0 +1,26 @@
<!DOCTYPE HTML>
<html class="reftest-wait">
<!--This testing should match the 15th frame of street.mp4. The
15th frame's time is 0.466666, so seek to a time which is a little
greater than 0.466666, the display frame should be the 15th frame.
-->
<head>
<script type="text/javascript">
function doTest() {
var video = document.getElementById("v1");
video.src = "../street.mp4";
video.preload = "metadata";
video.currentTime = 0.466667;
video.addEventListener("seeked", function() {
document.documentElement.removeAttribute('class');
});
}
window.addEventListener("MozReftestInvalidate", doTest);
</script>
</head>
<body>
<video id="v1" style="position:absolute; left:0; top:0"></video>
</body>
</html>