Skip to content

Commit

Permalink
Make a speech synthesis fail fast and tinker with others (web-platfor…
Browse files Browse the repository at this point in the history
…m-tests#34716)

This applies a nit from web-platform-tests#34710
and makes the "unexpected event" bits more consistent.
  • Loading branch information
foolip authored Mar 22, 2023
1 parent 00d2a40 commit 308366a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion speech-api/SpeechSynthesis-speak-events.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
async function runStartEndTest(t, utterance) {
const eventWatcher = new EventWatcher(t, utterance, ['start', 'end', 'error']);
await test_driver.bless('speechSynthesis.speak',
() => speechSynthesis.speak(utterance));
() => { speechSynthesis.speak(utterance) });
await eventWatcher.wait_for(['start', 'end']);
}
promise_test(async (t) => {
Expand Down
1 change: 1 addition & 0 deletions speech-api/SpeechSynthesis-speak-twice.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
test_driver.bless('speechSynthesis.speak', t.step_func(() => {
// the utterance is short to make the test faster
const utter = new SpeechSynthesisUtterance('1');
utter.onerror = t.unreached_func('error event');
speechSynthesis.speak(utter);
utter.onend = t.step_func(() => {
speechSynthesis.speak(utter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
utter.onerror = t.step_func_done((e) => {
assert_equals(e.error, "not-allowed");
});
utter.onend = t.step_func_done(() => assert_unreached());
utter.onend = t.unreached_func('end event');
speechSynthesis.speak(utter);
}, 'speechSynthesis.speak requires user activation');
</script>

0 comments on commit 308366a

Please sign in to comment.