Bug 1113600 - Part 3. Add mochitest for capturing media mid-playback. r=roc

This commit is contained in:
Andreas Pehrson 2014-12-21 14:46:24 +01:00
parent c9eccc83f4
commit cb41bae939
2 changed files with 49 additions and 0 deletions

View File

@ -338,6 +338,7 @@ skip-if = (toolkit == 'android' && processor == 'x86') #x86 only bug 914439
[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

View File

@ -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>