зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1275856- Update tests to reflect new MediaRecorderErrorEvent. r=jib
MediaRecorderErrorEvent is now fired in response to async errors in the MediaRecorder. This event wraps a DOMException and tests need to be updated to reflect this new behaviour. MozReview-Commit-ID: JIjIZlJJ8PE --HG-- extra : rebase_source : f9667b8a1b2a82959624831f3ef5109c19fccbd6
This commit is contained in:
Родитель
d30ae6e711
Коммит
f571e0f7e0
|
@ -21,7 +21,7 @@ function startTest() {
|
|||
|
||||
mediaRecorder.onerror = function (e) {
|
||||
is(callbackStep, 0, 'should fired onstop callback');
|
||||
is(e.name, 'GenericError', 'error name should be GenericError');
|
||||
is(e.error.name, 'UnknownError', 'error name should be UnknownError');
|
||||
is(mediaRecorder.mimeType, '', 'mimetype should be empty');
|
||||
is(mediaRecorder.state, 'recording', 'state is recording');
|
||||
info('onerror callback fired');
|
||||
|
|
|
@ -30,7 +30,7 @@ SpecialPowers.pushPrefEnv({"set": [["media.ogg.enabled", false]]},
|
|||
//fires again, so set it to null to avoid failures
|
||||
mediaRecorder.ondataavailable = null;
|
||||
SimpleTest.finish();
|
||||
}
|
||||
};
|
||||
mediaRecorder.ondataavailable = function(evt) {
|
||||
ondataavailableFired = true;
|
||||
ok(evt instanceof BlobEvent,
|
||||
|
@ -43,16 +43,18 @@ SpecialPowers.pushPrefEnv({"set": [["media.ogg.enabled", false]]},
|
|||
'Blob data received should have type = ' + expectedMimeType);
|
||||
is(evt.target.mimeType, expectedMimeType,
|
||||
'Mime type in ondataavailable = ' + expectedMimeType);
|
||||
}
|
||||
};
|
||||
mediaRecorder.onerror = function(evt) {
|
||||
ok(evt instanceof RecordErrorEvent,
|
||||
ok(evt instanceof MediaRecorderErrorEvent,
|
||||
'Events fired from onerror should be RecordErrorEvent');
|
||||
is(evt.type, 'error',
|
||||
'Event type should onerror');
|
||||
is(evt.name, 'GenericError',
|
||||
'Event name is GenericError');
|
||||
'Event type is error');
|
||||
ok(evt.error instanceof DOMException,
|
||||
'Events fired from onerror should have a DOMException in their error member');
|
||||
is(evt.error.name, 'UnknownError', 'Error name should be UnknownError.');
|
||||
is(evt.error.message, 'The operation failed for an unknown transient reason');
|
||||
onErrorFired = true;
|
||||
}
|
||||
};
|
||||
mediaRecorder.start(0);
|
||||
is(mediaRecorder.state, 'recording', 'Media recorder should be recording');
|
||||
is(mediaRecorder.stream, stream,
|
||||
|
|
|
@ -89,9 +89,9 @@ function testPrincipals(resource) {
|
|||
hasStopped = new Promise(resolve => rec.onstop = resolve);
|
||||
video.play();
|
||||
})
|
||||
.then(() => ok(true, msgNoThrow), e => is(e.name, null, msgNoThrow))
|
||||
.then(() => ok(true, msgNoThrow), e => is(e.error.name, null, msgNoThrow))
|
||||
.then(() => Promise.race([
|
||||
new Promise((_, reject) => rec.onerror = e => reject(new DOMException("", e.name))),
|
||||
new Promise((_, reject) => rec.onerror = e => reject(e.error)),
|
||||
hasEnded
|
||||
]))
|
||||
.then(() => ok(false, msgSecErr), e => is(e.name, "SecurityError", msgSecErr))
|
||||
|
|
|
@ -42,7 +42,7 @@ function startTest() {
|
|||
}
|
||||
}
|
||||
ok(callbackStep < 3, 'onerror callback fired as expected.');
|
||||
is(e.name, 'GenericError', 'Error name should be GenericError.');
|
||||
is(e.error.name, 'UnknownError', 'Error name should be UnknownError.');
|
||||
is(mediaRecorder.mimeType, '', 'mimetype should be empty');
|
||||
is(mediaRecorder.state, 'recording', 'state is recording');
|
||||
info('onerror callback fired');
|
||||
|
|
Загрузка…
Ссылка в новой задаче