Bug 1374189 - new testcase to count the total frame when "skip-to-next-key-frame.enabled" is false. r=kaku, jwwang
MozReview-Commit-ID: 4zjOoSAYild
--- a/dom/media/test/manifest.js
+++ b/dom/media/test/manifest.js
@@ -43,16 +43,24 @@ var gSmallTests = [
{ name:"seek-short.webm", type:"video/webm", width:320, height:240, duration:0.23 },
{ name:"vp9-short.webm", type:"video/webm", width:320, height:240, duration:0.20 },
{ name:"detodos-short.opus", type:"audio/ogg; codecs=opus", duration:0.22 },
{ name:"gizmo-short.mp4", type:"video/mp4", width:560, height:320, duration:0.27 },
{ name:"flac-s24.flac", type:"audio/flac", duration:4.04 },
{ name:"bogus.duh", type:"bogus/duh" }
];
+var gFrameCountTests = [
+ { name:"bipbop.mp4", type:"video/mp4", totalFrameCount:297},
+ { name:"gizmo.mp4", type:"video/mp4", totalFrameCount:166},
+ { name:"seek-short.webm", type:"video/webm", totalFrameCount:8},
+ { name:"seek.webm", type:"video/webm", totalFrameCount:120},
+ { name:"320x240.ogv", type:"video/ogg", totalFrameCount:8},
+];
+
if (SpecialPowers.Services.appinfo.name != "B2G") {
// We only run mochitests on b2g desktop and b2g emulator. The 3gp codecs
// aren't present on desktop, and the emulator codecs (which are different
// from the real device codecs) don't pass all of our tests, so we need
// to disable them.
gSmallTests = gSmallTests.concat([
{ name:"sample.3gp", type:"video/3gpp", duration:4.933 },
--- a/dom/media/test/mochitest.ini
+++ b/dom/media/test/mochitest.ini
@@ -50,16 +50,17 @@ support-files =
basic.vtt
bad-signature.vtt
beta-phrasebook.ogg
beta-phrasebook.ogg^headers^
big.wav
big.wav^headers^
big-short.wav
big-short.wav^headers^
+ bipbop.mp4
bipbop-cenc-audio1.m4s
bipbop-cenc-audio1.m4s^headers^
bipbop-cenc-audio2.m4s
bipbop-cenc-audio2.m4s^headers^
bipbop-cenc-audio3.m4s
bipbop-cenc-audio3.m4s^headers^
bipbop-cenc-audioinit.mp4
bipbop-cenc-audioinit.mp4^headers^
@@ -1191,16 +1192,18 @@ tags = suspend
skip-if = toolkit == 'android' # bug 1346705
tags = suspend
[test_background_video_ended_event.html]
skip-if = toolkit == 'android' # bug 1346705
tags = suspend
[test_temporary_file_blob_video_plays.html]
skip-if = toolkit == 'android' # android(bug 1232305)
+[test_videoPlaybackQuality_totalFrames.html]
+skip-if = (os == 'win' || android_version == '19') # bug 1374189
[test_video_gzip_encoding.html]
[test_playback_hls.html]
# HLS is only supported on Fennec with API level >= 16
# TODO: This test is similar to test_playback.html, will remove the
# redundant code once test_playback.html is enabled on Fennec.
skip-if = toolkit != 'android' || android_version < '16'
new file mode 100644
--- /dev/null
+++ b/dom/media/test/test_videoPlaybackQuality_totalFrames.html
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Count the tatol frames of a video</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ <script type="text/javascript" src="manifest.js"></script>
+</head>
+<body>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+var manager = new MediaTestManager;
+
+var startTest = function(test, token) {
+ manager.started(token);
+ var v = document.createElement('video');
+ v.token = token;
+ document.body.appendChild(v);
+ v.src = test.name;
+
+ function ended(event) {
+ var v = event.target;
+ is(v.getVideoPlaybackQuality().totalVideoFrames, test.totalFrameCount,test.name+ " totalFrames should match!");
+ removeNodeAndSource(v);
+ manager.finished(v.token);
+ }
+ v.addEventListener("ended", ended);
+ v.play();
+};
+
+SimpleTest.waitForExplicitFinish();
+SpecialPowers.pushPrefEnv(
+ {
+ "set": [
+ ["media.decoder.skip-to-next-key-frame.enabled", false]
+ ]
+ },
+ function() {
+ manager.runTests(getPlayableVideos(gFrameCountTests), startTest);
+ });
+
+</script>
+</pre>
+</body>
+</html>