Bug 1113600 - Part 3. Add mochitest for capturing media mid-playback. r=roc, a=sledru
authorAndreas Pehrson <pehrsons@gmail.com>
Sun, 21 Dec 2014 14:46:24 +0100
changeset 242920 c17e1f237ff0
parent 242919 e30a4672f03f
child 242921 b269b8f5102c
push id4341
push userryanvm@gmail.com
push date2015-01-20 15:33 +0000
treeherdermozilla-beta@595835cd60a0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, sledru
bugs1113600
milestone36.0
Bug 1113600 - Part 3. Add mochitest for capturing media mid-playback. r=roc, a=sledru
dom/media/test/mochitest.ini
dom/media/test/test_bug1113600.html
--- a/dom/media/test/mochitest.ini
+++ b/dom/media/test/mochitest.ini
@@ -331,16 +331,17 @@ skip-if = (toolkit == 'android' && proce
 [test_bug726904.html]
 [test_bug874897.html]
 [test_bug883173.html]
 [test_bug895091.html]
 [test_bug895305.html]
 [test_bug919265.html]
 [test_bug957847.html]
 [test_bug1018933.html]
+[test_bug1113600.html]
 [test_can_play_type.html]
 [test_can_play_type_mpeg.html]
 skip-if = buildapp == 'b2g' || (toolkit == 'android' && processor == 'x86') # bug 1021675 #x86 only bug 914439
 [test_can_play_type_no_ogg.html]
 [test_can_play_type_ogg.html]
 [test_chaining.html]
 [test_clone_media_element.html]
 skip-if = (toolkit == 'android' && processor == 'x86') #x86 only bug 914439
new file mode 100644
--- /dev/null
+++ b/dom/media/test/test_bug1113600.html
@@ -0,0 +1,48 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test that a video element captured to a stream mid-playback can be played to the end</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.style = "background-color:#aca;";
+  v.width = 160;
+  v.height = 120;
+
+  manager.started(token);
+
+  v.src = test.name;
+
+  v.ontimeupdate = function() {
+    if (v.currentTime < test.duration / 4) {
+      // Allow some time to pass before starting the capture.
+      return;
+    }
+    v.ontimeupdate = null;
+    v.mozCaptureStreamUntilEnded();
+    info(test.name + " capture started at " + v.currentTime + ". Duration=" + test.duration);
+  };
+
+  v.onended = function() {
+    ok(true, test.name + " ended");
+    removeNodeAndSource(v);
+    manager.finished(token);
+  };
+
+  document.body.appendChild(v);
+  v.play();
+}
+
+manager.runTests(gSmallTests, startTest);
+</script>
+</pre>
+</body>
+</html>