| Index: content/test/data/media/mediarecorder_test.html
|
| diff --git a/content/test/data/media/mediarecorder_test.html b/content/test/data/media/mediarecorder_test.html
|
| index c5d4cc13dbf88845e3a8c6a98f8f0953b484e7da..ea6f2c758c84a8ef14b974022292ae443db53f08 100644
|
| --- a/content/test/data/media/mediarecorder_test.html
|
| +++ b/content/test/data/media/mediarecorder_test.html
|
| @@ -484,6 +484,73 @@ function testIllegalRequestDataThrowsDOMError() {
|
| });
|
| }
|
|
|
| +// Tests that MediaRecorder fires an Error Event when the associated MediaStream
|
| +// gets a Track added.
|
| +function testAddingTrackToMediaStreamFiresErrorEvent() {
|
| + var theStream;
|
| + var theRecorder;
|
| + var errorEventReceived = false;
|
| + navigator.mediaDevices.getUserMedia(DEFAULT_CONSTRAINTS)
|
| + .then(function(stream) {
|
| + theStream = stream;
|
| + return createAndStartMediaRecorder(stream);
|
| + })
|
| + .then(function(recorder) {
|
| + theRecorder = recorder;
|
| + theRecorder.onerror = function(event) {
|
| + errorEventReceived = true;
|
| + assertEquals('inactive', theRecorder.state);
|
| + };
|
| + // Add a new track, copy of an existing one for simplicity.
|
| + theStream.addTrack(theStream.getTracks()[1].clone());
|
| + })
|
| + .then(function() {
|
| + return waitFor('Waiting for the Error Event',
|
| + function() {
|
| + return errorEventReceived;
|
| + });
|
| + })
|
| + .catch(function(err) {
|
| + return failTest(err.toString());
|
| + })
|
| + .then(function() {
|
| + reportTestSuccess();
|
| + });
|
| +}
|
| +
|
| +// Tests that MediaRecorder fires an Error Event when the associated MediaStream
|
| +// gets a Track removed.
|
| +function testRemovingTrackFromMediaStreamFiresErrorEvent() {
|
| + var theStream;
|
| + var theRecorder;
|
| + var errorEventReceived = false;
|
| + navigator.mediaDevices.getUserMedia(DEFAULT_CONSTRAINTS)
|
| + .then(function(stream) {
|
| + theStream = stream;
|
| + return createAndStartMediaRecorder(stream);
|
| + })
|
| + .then(function(recorder) {
|
| + theRecorder = recorder;
|
| + theRecorder.onerror = function(event) {
|
| + errorEventReceived = true;
|
| + assertEquals('inactive', theRecorder.state);
|
| + };
|
| + theStream.removeTrack(theStream.getTracks()[1]);
|
| + })
|
| + .then(function() {
|
| + return waitFor('Waiting for the Error Event',
|
| + function() {
|
| + return errorEventReceived;
|
| + });
|
| + })
|
| + .catch(function(err) {
|
| + return failTest(err.toString());
|
| + })
|
| + .then(function() {
|
| + reportTestSuccess();
|
| + });
|
| +}
|
| +
|
| </script>
|
| </body>
|
| </html>
|
|
|