From 3951cf16d23b711982761b1bf9cffc799eba7258 Mon Sep 17 00:00:00 2001 From: bechen Date: Tue, 25 Jul 2017 10:41:41 +0800 Subject: [PATCH] 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 --- dom/media/test/reftest/generateREF.html | 21 ++++++++++++++- dom/media/test/reftest/reftest.list | 3 ++- .../reftest/street.mp4.15thframe-ref.html | 4 +++ dom/media/test/reftest/street.mp4.seek.html | 26 +++++++++++++++++++ 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 dom/media/test/reftest/street.mp4.15thframe-ref.html create mode 100644 dom/media/test/reftest/street.mp4.seek.html diff --git a/dom/media/test/reftest/generateREF.html b/dom/media/test/reftest/generateREF.html index 72ac04d97908..29927a854f3f 100644 --- a/dom/media/test/reftest/generateREF.html +++ b/dom/media/test/reftest/generateREF.html @@ -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"; diff --git a/dom/media/test/reftest/reftest.list b/dom/media/test/reftest/reftest.list index c551ce964d3f..0a229e092df3 100644 --- a/dom/media/test/reftest/reftest.list +++ b/dom/media/test/reftest/reftest.list @@ -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 \ No newline at end of file +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 \ No newline at end of file diff --git a/dom/media/test/reftest/street.mp4.15thframe-ref.html b/dom/media/test/reftest/street.mp4.15thframe-ref.html new file mode 100644 index 000000000000..5f48ddd02a43 --- /dev/null +++ b/dom/media/test/reftest/street.mp4.15thframe-ref.html @@ -0,0 +1,4 @@ + + diff --git a/dom/media/test/reftest/street.mp4.seek.html b/dom/media/test/reftest/street.mp4.seek.html new file mode 100644 index 000000000000..4ee56f3bf54c --- /dev/null +++ b/dom/media/test/reftest/street.mp4.seek.html @@ -0,0 +1,26 @@ + + + + + + + + + +