зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1514016 - Check that MediaRecorder::Stop is idempotent. r=jib
Differential Revision: https://phabricator.services.mozilla.com/D15911 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
e48df97d26
Коммит
b0c7430863
|
@ -30,6 +30,13 @@
|
||||||
assert_equals(event.type, "stop", "the event type should be stop");
|
assert_equals(event.type, "stop", "the event type should be stop");
|
||||||
assert_true(event.isTrusted, "isTrusted should be true when the event is created by C++");
|
assert_true(event.isTrusted, "isTrusted should be true when the event is created by C++");
|
||||||
assert_equals(recorder.state, "inactive", "MediaRecorder is inactive after stop event");
|
assert_equals(recorder.state, "inactive", "MediaRecorder is inactive after stop event");
|
||||||
|
|
||||||
|
recorder.stop();
|
||||||
|
await Promise.race([
|
||||||
|
new Promise((_, reject) => recorder.onstop =
|
||||||
|
_ => reject(new Error("stop() is idempotent"))),
|
||||||
|
new Promise(r => t.step_timeout(r, 0))
|
||||||
|
]);
|
||||||
}, "MediaRecorder will stop recording and fire a stop event when all tracks are ended");
|
}, "MediaRecorder will stop recording and fire a stop event when all tracks are ended");
|
||||||
|
|
||||||
promise_test(async t => {
|
promise_test(async t => {
|
||||||
|
@ -45,6 +52,13 @@
|
||||||
assert_equals(event.type, "stop", "the event type should be stop");
|
assert_equals(event.type, "stop", "the event type should be stop");
|
||||||
assert_true(event.isTrusted, "isTrusted should be true when the event is created by C++");
|
assert_true(event.isTrusted, "isTrusted should be true when the event is created by C++");
|
||||||
assert_equals(recorder.state, "inactive", "MediaRecorder is inactive after stop event");
|
assert_equals(recorder.state, "inactive", "MediaRecorder is inactive after stop event");
|
||||||
|
|
||||||
|
recorder.stop();
|
||||||
|
await Promise.race([
|
||||||
|
new Promise((_, reject) => recorder.onstop =
|
||||||
|
_ => reject(new Error("stop() is idempotent"))),
|
||||||
|
new Promise(r => t.step_timeout(r, 0))
|
||||||
|
]);
|
||||||
}, "MediaRecorder will stop recording and fire a stop event when stop() is called");
|
}, "MediaRecorder will stop recording and fire a stop event when stop() is called");
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче