Bug 1235301 part 5 - mochitest;r?jwwang draft
authorKaku Kuo <tkuo@mozilla.com>
Mon, 23 May 2016 19:19:07 +0800
changeset 369999 e3ce050ed99056a0f9f3ca03caac31e617c14f13
parent 369983 a8b855e9e620b0649818f2565df46da4bd1cc818
child 521669 3e658230d6e8702383c120ed50fe647d00e0198e
push id18972
push usertkuo@mozilla.com
push dateTue, 24 May 2016 03:28:07 +0000
reviewersjwwang
bugs1235301
milestone49.0a1
Bug 1235301 part 5 - mochitest;r?jwwang MozReview-Commit-ID: 6NzyMk8pFS7
dom/media/test/manifest.js
dom/media/test/mochitest.ini
dom/media/test/test_seekToNextFrame.html
--- a/dom/media/test/manifest.js
+++ b/dom/media/test/manifest.js
@@ -271,16 +271,63 @@ var gPlayTests = [
   // there is really only one second worth of data. We want MP3FrameParser to
   // trust the header, so this should be reported as 10 seconds.
   { name:"vbr-head.mp3", type:"audio/mpeg", duration:10.00 },
 
   // Invalid file
   { name:"bogus.duh", type:"bogus/duh", duration:Number.NaN },
 ];
 
+var gSeekToNextFrameTests = [
+  // Test playback of a WebM file with vp9 video
+  { name:"vp9.webm", type:"video/webm", duration:4 },
+  { name:"vp9cake.webm", type:"video/webm", duration:7.966 },
+  // oggz-chop stream
+  { name:"bug482461.ogv", type:"video/ogg", duration:4.34 },
+  // Theora only oggz-chop stream
+  { name:"bug482461-theora.ogv", type:"video/ogg", duration:4.138 },
+  // With first frame a "duplicate" (empty) frame.
+  { name:"bug500311.ogv", type:"video/ogg", duration:1.96 },
+
+  // More audio in file than video.
+  { name:"short-video.ogv", type:"video/ogg", duration:1.081 },
+  // First Theora data packet is zero bytes.
+  { name:"bug504613.ogv", type:"video/ogg", duration:Number.NaN },
+  // Multiple audio streams.
+  { name:"bug516323.ogv", type:"video/ogg", duration:4.208 },
+  // oggz-chop with non-keyframe as first frame
+  { name:"bug556821.ogv", type:"video/ogg", duration:2.551 },
+  // Various weirdly formed Ogg files
+  { name:"bug498855-1.ogv", type:"video/ogg", duration:0.24 },
+  { name:"bug498855-2.ogv", type:"video/ogg", duration:0.24 },
+  { name:"bug498855-3.ogv", type:"video/ogg", duration:0.24 },
+  { name:"bug504644.ogv", type:"video/ogg", duration:1.6 },
+
+  { name:"bug523816.ogv", type:"video/ogg", duration:0.533 },
+
+  { name:"bug498380.ogv", type:"video/ogg", duration:0.533 },
+  { name:"bug557094.ogv", type:"video/ogg", duration:0.24 },
+  { name:"multiple-bos.ogg", type:"video/ogg", duration:0.431 },
+  // Test playback/metadata work after a redirect
+  { name:"redirect.sjs?domain=mochi.test:8888&file=320x240.ogv",
+    type:"video/ogg", duration:0.266 },
+  // Test playback of a webm file
+  { name:"seek.webm", type:"video/webm", duration:3.966 },
+  // Test playback of a WebM file with non-zero start time.
+  { name:"split.webm", type:"video/webm", duration:1.967 },
+  // Test playback of a raw file
+  { name:"seek.yuv", type:"video/x-raw-yuv", duration:1.833 },
+
+  { name:"gizmo.mp4", type:"video/mp4", duration:5.56 },
+
+  // Test playback of a MP4 file with a non-zero start time (and audio starting
+  // a second later).
+  { name:"bipbop-lateaudio.mp4", type:"video/mp4" },
+];
+
 // A file for each type we can support.
 var gSnifferTests = [
   { name:"big.wav", type:"audio/x-wav", duration:9.278982, size:102444 },
   { name:"320x240.ogv", type:"video/ogg", width:320, height:240, duration:0.233, size:28942 },
   { name:"seek.webm", type:"video/webm", duration:3.966, size:215529 },
   { name:"gizmo.mp4", type:"video/mp4", duration:5.56, size:383631 },
   // A mp3 file with id3 tags.
   { name:"id3tags.mp3", type:"audio/mpeg", duration:0.28, size:3530},
--- a/dom/media/test/mochitest.ini
+++ b/dom/media/test/mochitest.ini
@@ -794,16 +794,18 @@ skip-if = true # bug 1021673
 [test_seek-8.html]
 [test_seek-9.html]
 [test_seek-10.html]
 [test_seek-11.html]
 [test_seek-12.html]
 [test_seek-13.html]
 [test_seekable1.html]
 [test_seekLies.html]
+[test_seekToNextFrame.html]
+tags=seektonextframe
 [test_source.html]
 [test_source_media.html]
 [test_source_null.html]
 [test_source_write.html]
 [test_standalone.html]
 [test_streams_autoplay.html]
 tags=msg capturestream
 [test_streams_capture_origin.html]
new file mode 100644
--- /dev/null
+++ b/dom/media/test/test_seekToNextFrame.html
@@ -0,0 +1,74 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test SeekToNextFrame of media files that should play OK</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;
+
+function startTest(test, token) {
+  var v = document.createElement('video');
+  v.preload = "metadata";
+  v.token = token;
+  v.seenSeeking = false;
+  v.seenEnded = false;
+
+  var handler = {
+    "ontimeout": function() {
+      Log(token, "timed out: ended=" + v.seenEnded);
+    }
+  };
+  manager.started(token, handler);
+
+  v.src = test.name;
+  v.name = test.name;
+
+  var onLoadedmetadata = function(test, v) { return function() {
+    v.SeekToNextFrame();
+  }}(test, v);
+
+  var finish = function() {
+    v.finished = true;
+    v.removeEventListener("loadedmetadata", onLoadedmetadata, false);
+    v.removeEventListener("seeking", onSeeking, false);
+    v.removeEventListener("seeked", onSeeked, false);
+    removeNodeAndSource(v);
+    manager.finished(v.token);
+  }
+
+  var onEnded = function(test, v) { return function() {
+    v.seenEnded = true;
+    finish();
+  }}(test, v);
+
+  var onSeeking = function(test, v) { return function() {
+    ok(!v.seenSeeking, "Should yet receive seeking event.")
+    v.seenSeeking = true;
+  }}(test, v);
+
+  var onSeeked = function(test, v) { return function() {
+    ok(v.seenSeeking, "Should have already received seeking event.")
+    v.seenSeeking = false;
+    v.SeekToNextFrame();
+  }}(test, v);
+
+  v.addEventListener("loadedmetadata", onLoadedmetadata, false);
+  v.addEventListener("seeking", onSeeking, false);
+  v.addEventListener("seeked", onSeeked, false);
+  v.addEventListener("ended", onEnded, false);
+
+  document.body.appendChild(v);
+}
+
+manager.runTests(gSeekToNextFrameTests, startTest);
+
+</script>
+</pre>
+</body>
+</html>
\ No newline at end of file