Bug 897776 - Test case for MediaRecorder infinite recursion with requestData() calls in "dataavailable" event. r=jsmith
authorRandy Lin <rlin@mozilla.com>
Sun, 11 Aug 2013 11:35:16 +0800
changeset 142321 16d14f3212fc828f6f0bb838f30263af072ab337
parent 142320 6bf6013084ca76476e3433647938d5081e86f1c8
child 142322 328f5dc019497eee6c3f16986ff12ddb2284c204
push id32372
push userryanvm@gmail.com
push dateTue, 13 Aug 2013 01:59:20 +0000
treeherdermozilla-inbound@86b6480829c8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjsmith
bugs897776
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 897776 - Test case for MediaRecorder infinite recursion with requestData() calls in "dataavailable" event. r=jsmith
content/media/test/Makefile.in
content/media/test/test_mediarecorder_avoid_recursion.html
testing/mochitest/b2g.json
--- a/content/media/test/Makefile.in
+++ b/content/media/test/Makefile.in
@@ -111,16 +111,17 @@ MOCHITEST_FILES = \
 		test_source.html \
 		test_source_write.html \
 		test_source_null.html \
 		test_standalone.html \
 		test_volume.html \
 		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 \
 		test_source_media.html \
 		test_autoplay_contentEditable.html \
 		test_bug448534.html \
 		test_bug463162.xhtml \
 		test_decoder_disable.html \
new file mode 100644
--- /dev/null
+++ b/content/media/test/test_mediarecorder_avoid_recursion.html
@@ -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>
+
--- a/testing/mochitest/b2g.json
+++ b/testing/mochitest/b2g.json
@@ -27,16 +27,17 @@
     "content/media/test/test_delay_load.html": "6 failures",
     "content/media/test/test_error_on_404.html": "timed out",
     "content/media/test/test_framebuffer.html": "timed out",
     "content/media/test/test_info_leak.html": "2 failures",
     "content/media/test/test_load.html": "Timed out after gizmo.mp4",
     "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",
     "content/media/test/test_play_events_2.html": "Last event should be canplaythrough for gizmo.mp4 - got playing, expected canplaythrough",
     "content/media/test/test_playback.html": "Test timed out, bug 668973?",
     "content/media/test/test_playback_rate_playpause.html": "",
     "content/media/test/test_progress.html": "bug 901716 - timeouts",
     "content/media/test/test_reactivate.html": "timed out in small-shot.mp3",