Repository navigation
SpeechSynthesis.speak requires activation - #12327
Conversation
| <script> | ||
| // using an utterance for different SpeechSynthesis instances should throw | ||
| test(t => { | ||
| var t = async_test( |
There was a problem hiding this comment.
The previous test(f(t), name) structure works for async_test as well, just change test to async_test.
| test(t => { | ||
| var t = async_test( | ||
| 'Using the same SpeechSynthesisUtterance with two SpeechSynthesis instances'); | ||
| test_driver.click(document.body).then(t.step_func(() => { |
There was a problem hiding this comment.
If you use test_driver.bless, this test will be easier to run manually. (Caveat: I haven't tried it myself.)
| var t = async_test('speechSynthesis.speak requires user activation'); | ||
| const utter = new SpeechSynthesisUtterance('1'); | ||
| utter.onerror = t.step_func_done((e) => { | ||
| assert_equals(e.name, "not-allowed"); |
| <p>Some body text. | ||
| <script> | ||
| var t = async_test('speechSynthesis.speak requires user activation'); | ||
| const utter = new SpeechSynthesisUtterance('1'); |
There was a problem hiding this comment.
Can you use the async_test(f(n), name) structure here as well? The reason is that if new SpeechSynthesisUtterance('1') throws an exception in the current structure, it would be a harness error plus a test that times out, instead of a failing test. Putting all the interesting code inside the first callback or in t.step_func for callbacks avoids this kind of problem.
| @@ -0,0 +1,13 @@ | |||
| <!doctype html> | |||
There was a problem hiding this comment.
As discussed in WebAudio/web-speech-api#28 (comment), maybe make this test tenatative (name it "SpeechSynthesis-speak-without-activation-fails.tentative.html") and link to an open issue in the speech-api repo.
|
Thanks for the review, Philip! |
| iframe.contentWindow.speechSynthesis.speak(utter); | ||
| }); | ||
| async_test(t => { | ||
| test_driver.bless('speechSynthesis.speak', t.step_func(() => { |
There was a problem hiding this comment.
Oops, looks like this test will never finish, using t.step_func_done here would fix it.
There was a problem hiding this comment.
Done. Also changed some of the other tests to use t.step_func as arguments to bless(), which I think is needed.
| <script src="/resources/testharnessreport.js"></script> | ||
| <script src="/resources/testdriver.js"></script> | ||
| <script src="/resources/testdriver-vendor.js"></script> | ||
| <p>Some body text. |
There was a problem hiding this comment.
You probably don't need this text now that you're using test_driver.bless instead. Ditto in following tests.
There was a problem hiding this comment.
Actually we still need it, since bless requires the document body to be around.
There was a problem hiding this comment.
Ah, if that's all you need then <body> would be clearer. Plenty of tests to that ahead of doing something with document.body.
|
Hey Philip, is there anything else blocking merging this and the associated spec PR? |
|
I made the |
|
I confirmed the tests are working properly, thanks for the quick fixes. |
To be merged with WebAudio/web-speech-api#28 if it ends up with normative changes involving user activation.
CC @foolip