Bug 1514158 - Test that MediaRecorder.start() throws if MediaRecorder.stream is inactive. r=bryce

Differential Revision: https://phabricator.services.mozilla.com/D41587

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Pehrson 2019-10-03 22:08:58 +00:00
Родитель bf71d848ad
Коммит 2c2903d85c
1 изменённых файлов: 11 добавлений и 3 удалений

Просмотреть файл

@ -82,11 +82,11 @@
assert_throws("NotSupportedError",
function() {
recorder =
new MediaRecorder(stream, {mimeType : "video/invalid"});
recorder = new MediaRecorder(
new MediaStream(), {mimeType : "video/invalid"});
},
"recorder should throw() with unsupported mimeType");
let recorder = new MediaRecorder(stream);
let recorder = new MediaRecorder(new MediaStream());
assert_equals(recorder.state, "inactive");
recorder.stop();
@ -98,6 +98,14 @@
assert_throws("InvalidStateError", function(){recorder.requestData()},
"cannot requestData() if recorder is in |inactive| state");
assert_throws("NotSupportedError",
function() {
recorder.start();
},
"recorder should throw() when starting with inactive stream");
recorder.stream.addTrack(stream.getTracks()[0]);
drawSomethingOnCanvas();
recorder.onstop = recorderOnUnexpectedEvent;