summaryrefslogtreecommitdiffstats
path: root/dom/media/test/test_mediarecorder_creation_fail.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_creation_fail.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_creation_fail.html')
-rw-r--r--dom/media/test/test_mediarecorder_creation_fail.html66
1 files changed, 66 insertions, 0 deletions
diff --git a/dom/media/test/test_mediarecorder_creation_fail.html b/dom/media/test/test_mediarecorder_creation_fail.html
new file mode 100644
index 000000000..903bf1cc7
--- /dev/null
+++ b/dom/media/test/test_mediarecorder_creation_fail.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test MediaRecorder Record with media.ogg.enabled = false</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">
+
+function startTest() {
+ // the expect sequence should be
+ // 1. onerror
+ // 2. ondataavailable
+ // 3. onstop
+ var callbackStep = 0;
+ var stream = new AudioContext().createMediaStreamDestination().stream;
+ var mediaRecorder = new MediaRecorder(stream);
+
+ mediaRecorder.onerror = function (e) {
+ is(callbackStep, 0, 'should fired onstop callback');
+ 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');
+ callbackStep = 1;
+ };
+
+ mediaRecorder.onwarning = function () {
+ ok(false, 'Unexpected onwarning callback fired');
+ };
+
+ mediaRecorder.onstop = function () {
+ info('onstop callback fired');
+ is(mediaRecorder.state, 'inactive', 'state should be inactive');
+ is(callbackStep, 2, 'should fired onstop callback');
+ SimpleTest.finish();
+ };
+
+ // This handler fires every 250ms to generate a blob.
+ mediaRecorder.ondataavailable = function (evt) {
+ info('ondataavailable callback fired');
+ is(callbackStep, 1, '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');
+ callbackStep = 2;
+ };
+
+ // Start recording
+ mediaRecorder.start(250);
+ is(mediaRecorder.state, 'recording', 'Media recorder should be recording');
+ is(mediaRecorder.stream, stream,
+ 'Media recorder stream = element stream at the start of recording');
+}
+
+SimpleTest.waitForExplicitFinish();
+SpecialPowers.pushPrefEnv({"set": [["media.ogg.enabled", false]]}, startTest);
+
+</script>
+</pre>
+</body>
+</html>