2015-07-07 08:43:00 +03:00
|
|
|
<!DOCTYPE HTML>
|
2014-02-10 12:55:22 +04:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Bug 957452 Test GetEncodedData problem on asan build</title>
|
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<pre id="test">
|
|
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
2014-12-11 21:34:40 +03:00
|
|
|
SimpleTest.requestFlakyTimeout("untriaged");
|
2014-02-10 12:55:22 +04:00
|
|
|
SpecialPowers.pushPrefEnv({"set": [["media.ogg.enabled", false]]},
|
|
|
|
function () {
|
|
|
|
var ac = new window.AudioContext();
|
|
|
|
var dest = ac.createMediaStreamDestination();
|
|
|
|
var stream = dest.stream;
|
|
|
|
var onErrorFired = false;
|
|
|
|
var expectedMimeType = '';
|
|
|
|
var ondataavailableFired = false;
|
|
|
|
setTimeout(function() {
|
|
|
|
var mediaRecorder = new MediaRecorder(stream);
|
|
|
|
mediaRecorder.onstop = function(e) {
|
|
|
|
is(e.target.state, 'inactive',
|
|
|
|
'Media recorder is inactive after being stopped');
|
|
|
|
ok(onErrorFired, 'onStop after onError');
|
|
|
|
ok(ondataavailableFired, 'ondataavailableFired');
|
|
|
|
|
2014-08-11 07:10:53 +04:00
|
|
|
//Apparently, as soon as the document is unloading, mediaRecorder.ondataavailable
|
|
|
|
//fires again, so set it to null to avoid failures
|
|
|
|
mediaRecorder.ondataavailable = null;
|
2014-02-10 12:55:22 +04:00
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
|
|
|
mediaRecorder.ondataavailable = function(evt) {
|
2014-03-03 11:34:14 +04:00
|
|
|
ondataavailableFired = true;
|
|
|
|
ok(evt instanceof BlobEvent,
|
|
|
|
'Events fired from ondataavailable should be BlobEvent');
|
|
|
|
is(evt.type, 'dataavailable',
|
|
|
|
'Event type should dataavailable');
|
|
|
|
is(evt.data.size, 0,
|
|
|
|
'Blob data size received is equal to zero');
|
|
|
|
is(evt.data.type, expectedMimeType,
|
|
|
|
'Blob data received should have type = ' + expectedMimeType);
|
|
|
|
is(evt.target.mimeType, expectedMimeType,
|
|
|
|
'Mime type in ondataavailable = ' + expectedMimeType);
|
2014-02-10 12:55:22 +04:00
|
|
|
}
|
|
|
|
mediaRecorder.onerror = function(evt) {
|
|
|
|
ok(evt instanceof RecordErrorEvent,
|
|
|
|
'Events fired from onerror should be RecordErrorEvent');
|
|
|
|
is(evt.type, 'error',
|
|
|
|
'Event type should onerror');
|
|
|
|
is(evt.name, 'GenericError',
|
|
|
|
'Event name is GenericError');
|
|
|
|
onErrorFired = true;
|
|
|
|
}
|
|
|
|
mediaRecorder.start(0);
|
|
|
|
is(mediaRecorder.state, 'recording', 'Media recorder should be recording');
|
|
|
|
is(mediaRecorder.stream, stream,
|
|
|
|
'Media recorder stream = element stream at the start of recording');
|
|
|
|
mediaRecorder.requestData();
|
|
|
|
}, 100);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|