1
0
Fork 0
firefox/testing/web-platform/tests/speech-api/SpeechRecognition-onstart-onend.https.html
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

36 lines
982 B
HTML

<!DOCTYPE html>
<title>SpeechRecognition onstart and onend events</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
promise_test(async t => {
window.SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
const recognition = new SpeechRecognition();
// Promise that resolves when the 'start' event is fired.
const startPromise = new Promise(resolve => {
recognition.onstart = () => {
resolve();
};
});
// Promise that resolves when the 'end' event is fired.
const endPromise = new Promise(resolve => {
recognition.onend = () => {
resolve();
};
});
// Start speech recognition.
recognition.start();
// Wait for the 'start' event.
await startPromise;
// Stop speech recognition.
recognition.stop();
// Wait for the 'end' event.
await endPromise;
}, 'Speech recognition onstart and onend events are called.');
</script>