summaryrefslogtreecommitdiffstats
path: root/dom/media/test/test_mediarecorder_unsupported_src.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/media/test/test_mediarecorder_unsupported_src.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/media/test/test_mediarecorder_unsupported_src.html')
-rw-r--r--dom/media/test/test_mediarecorder_unsupported_src.html99
1 files changed, 99 insertions, 0 deletions
diff --git a/dom/media/test/test_mediarecorder_unsupported_src.html b/dom/media/test/test_mediarecorder_unsupported_src.html
new file mode 100644
index 000000000..cbbc82e7d
--- /dev/null
+++ b/dom/media/test/test_mediarecorder_unsupported_src.html
@@ -0,0 +1,99 @@
+<html>
+<head>
+ <title>Bug 957439 - Media Recording - Assertion fail at Pause if unsupported input stream.</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=957439">Mozilla Bug 957439</a>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+
+function startTest() {
+ // also do general checks on mimetype support for audio-only
+ ok(MediaRecorder.isTypeSupported("audio/ogg"), 'Should support audio/ogg');
+ ok(MediaRecorder.isTypeSupported('audio/ogg; codecs="opus"'), 'Should support audio/ogg+opus');
+ ok(!MediaRecorder.isTypeSupported('audio/ogg; codecs="foobar"'), 'Should not support audio/ogg + unknown_codec');
+ ok(!MediaRecorder.isTypeSupported("video/webm"), 'Should not support video/webm');
+ ok(!MediaRecorder.isTypeSupported("video/mp4"), 'Should not support video/mp4');
+
+ navigator.mozGetUserMedia({audio: false, video: true, fake: true},
+ function(stream) {
+
+ // Expected callback sequence should be:
+ // 1. onerror (from start)
+ // 2. onerror (from pause)
+ // 3. ondataavailable
+ // 4. onstop
+ var callbackStep = 0;
+ var mediaRecorder = new MediaRecorder(stream);
+
+ is(mediaRecorder.stream, stream, 'Stream should be provided on creation');
+
+ mediaRecorder.onerror = function (e) {
+ callbackStep++;
+ if (callbackStep == 1) {
+ try {
+ mediaRecorder.pause();
+ } catch(e) {
+ ok(false, 'Should not get exception in pause call.');
+ }
+ }
+ ok(callbackStep < 3, 'onerror callback fired as expected.');
+ is(e.name, 'GenericError', 'Error name should be GenericError.');
+ is(mediaRecorder.mimeType, '', 'mimetype should be empty');
+ is(mediaRecorder.state, 'recording', 'state is recording');
+ info('onerror callback fired');
+ }
+
+ mediaRecorder.onwarning = function () {
+ ok(false, 'Unexpected onwarning callback fired.');
+ };
+
+ mediaRecorder.ondataavailable = function (evt) {
+ callbackStep++;
+ info('ondataavailable callback fired');
+ is(callbackStep, 3, 'should fired ondataavailable callback');
+ is(evt.data.size, 0, 'data size should be zero');
+ ok(evt instanceof BlobEvent,
+ 'Events fired from ondataavailable should be BlobEvent');
+ is(evt.data.type, '', 'encoder start fail, blob miemType should be empty');
+ };
+
+ mediaRecorder.onstop = function() {
+ callbackStep++;
+ info('onstop callback fired');
+ is(mediaRecorder.state, 'inactive', 'state should be inactive');
+ is(callbackStep, 4, 'should fired onstop callback');
+ SimpleTest.finish();
+ };
+
+ try {
+ mediaRecorder.start();
+ } catch(e) {
+ ok(false, 'Should not get exception in start call.');
+ }
+ },
+ function(err) {
+ ok(false, 'Unexpected error fired with: ' + err);
+ SimpleTest.finish();
+ }
+ );
+}
+
+SimpleTest.waitForExplicitFinish();
+
+// In order to generate an "unsupported stream", pref off video encoding to
+// make the platform support audio encoding only.
+SpecialPowers.pushPrefEnv(
+ {
+ "set": [
+ ["media.encoder.webm.enabled", false],
+ ]
+ }, startTest);
+
+</script>
+</head>
+</html>