Bug 897776 - Test case for MediaRecorder infinite recursion with requestData() calls in "dataavailable" event. r=jsmith

This commit is contained in:
Randy Lin 2013-08-11 11:35:16 +08:00
parent 9c7ebebbcd
commit 0064bc2e7a
3 changed files with 46 additions and 0 deletions

View File

@ -116,6 +116,7 @@ MOCHITEST_FILES = \
test_video_to_canvas.html \
test_audiowrite.html \
test_mediarecorder_creation.html \
test_mediarecorder_avoid_recursion.html \
test_mediarecorder_record_audiocontext.html \
test_mediarecorder_record_stopms.html \
test_mozHasAudio.html \

View File

@ -0,0 +1,44 @@
<html>
<head>
<title>MediaRecorder infinite recursion with requestData() calls in "dataavailable" event</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>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=897776">Mozill
a Bug 897776</a>
<pre id="test">
<script class="testbody" type="text/javascript">
function startTest() {
navigator.mozGetUserMedia({audio: true, fake: true}, function(stream) {
var mediaRecorder = new MediaRecorder(stream);
var count = 0;
mediaRecorder.start();
mediaRecorder.ondataavailable = function (e) {
if (count++ == 30) {
stream.stop();
}
if (mediaRecorder.state == 'recording') {
mediaRecorder.requestData();
}
}
mediaRecorder.requestData();
mediaRecorder.onstop = function () {
ok(true, "requestData within ondataavailable successfully avoided infinite recursion");
SimpleTest.finish();
}
}, function(err) {
ok(false, 'Unexpected error fired with: ' + err);
SimpleTest.finish();
});
}
SimpleTest.waitForExplicitFinish();
startTest();
</script>
</pre>
</body>
</html>

View File

@ -32,6 +32,7 @@
"content/media/test/test_load_candidates.html": "timed out",
"content/media/test/test_load_same_resource.html": "",
"content/media/test/test_media_selection.html": "timed out",
"content/media/test/test_mediarecorder_avoid_recursion.html": "guM isn't ready on b2g, bug 903765",
"content/media/test/test_metadata.html": "",
"content/media/test/test_mozHasAudio.html": "",
"content/media/test/test_play_events.html": "Last event should be canplaythrough for gizmo.mp4 - got playing, expected canplaythrough",