Bug 1491069 [wpt PR 12992] - Add tests for SpeechSynthesis pause() and resume(), a=testonly

Automatic update from web-platform-testsAdd tests for SpeechSynthesis pause() and resume() (#12992)

For https://bugs.chromium.org/p/chromium/issues/detail?id=679043

Spec bugs:
https://github.com/w3c/speech-api/issues/39
https://github.com/w3c/speech-api/issues/40
--

wpt-commits: d85043d2c674aef5a8939c18454c683f82eaab2c
wpt-pr: 12992
This commit is contained in:
Philip Jägenstedt 2018-09-17 13:45:47 +00:00 committed by moz-wptsync-bot
parent b973eca84b
commit 827eb612e3
3 changed files with 80 additions and 15 deletions

View File

@ -397789,6 +397789,22 @@
{}
]
],
"speech-api/SpeechSynthesis-pause-resume.tentative.html": [
[
"/speech-api/SpeechSynthesis-pause-resume.tentative.html",
{
"testdriver": true
}
]
],
"speech-api/SpeechSynthesis-speak-events.html": [
[
"/speech-api/SpeechSynthesis-speak-events.html",
{
"testdriver": true
}
]
],
"speech-api/SpeechSynthesis-speak-ownership.html": [
[
"/speech-api/SpeechSynthesis-speak-ownership.html",
@ -397805,14 +397821,6 @@
}
]
],
"speech-api/SpeechSynthesis-speak-with-activation-succeeds.html": [
[
"/speech-api/SpeechSynthesis-speak-with-activation-succeeds.html",
{
"testdriver": true
}
]
],
"speech-api/SpeechSynthesis-speak-without-activation-fails.tentative.html": [
[
"/speech-api/SpeechSynthesis-speak-without-activation-fails.tentative.html",
@ -645994,6 +646002,14 @@
"e4741b7fc6f450a5038f99c1b3de15ae4f5b0db0",
"manual"
],
"speech-api/SpeechSynthesis-pause-resume.tentative.html": [
"a7aa2bbf6fa25fec45845b1b08801148649fc4a2",
"testharness"
],
"speech-api/SpeechSynthesis-speak-events.html": [
"babfe3c388e92aee8c4e6ea62cd3c038eb5bcb2d",
"testharness"
],
"speech-api/SpeechSynthesis-speak-ownership.html": [
"f2121fc561de1f25a4de27372ca42a2b1e97a10a",
"testharness"
@ -646002,10 +646018,6 @@
"3e0388b9cf37cae2075380faf48414a48b4092e9",
"testharness"
],
"speech-api/SpeechSynthesis-speak-with-activation-succeeds.html": [
"55dec5c123ff6384e6a30694c6a9fb6b27bc5b51",
"testharness"
],
"speech-api/SpeechSynthesis-speak-without-activation-fails.tentative.html": [
"acf0d7d575b5dc7f9b348d82b056aa90089b6639",
"testharness"

View File

@ -0,0 +1,50 @@
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<body>
<script>
// This test is tentative because timing isn't defined:
// https://github.com/w3c/speech-api/issues/39
// https://github.com/w3c/speech-api/issues/40
async_test(t => {
assert_false(speechSynthesis.paused, 'initial paused state');
test_driver.bless('speechSynthesis.speak', t.step_func(() => {
const sentence = `long sentence which will take at least a few seconds to
utter so that it's possible to pause and resume before the end`;
const utter = new SpeechSynthesisUtterance(sentence);
t.add_cleanup(() => speechSynthesis.pause());
utter.onerror = t.unreached_func('error event');
speechSynthesis.speak(utter);
assert_false(speechSynthesis.paused, 'paused state after speak()');
utter.onstart = t.step_func(() => {
utter.onstart = null;
assert_false(speechSynthesis.paused, 'paused state at start event');
speechSynthesis.pause();
// paused state changes async, right before the pause event
assert_false(speechSynthesis.paused, 'paused state after pause()');
utter.onpause = t.step_func(() => {
utter.onpause = null;
assert_true(speechSynthesis.paused, 'paused state at pause event');
speechSynthesis.resume();
// paused state changes async, right before the resume event
assert_true(speechSynthesis.paused, 'paused state after resume()');
utter.onresume = t.step_func_done(() => {
assert_false(speechSynthesis.paused, 'paused state at resume event');
});
});
});
}));
}, 'speechSynthesis.pause() and resume() state and events');
</script>

View File

@ -7,9 +7,12 @@
<script>
async_test(t => {
test_driver.bless('speechSynthesis.speak', t.step_func(() => {
const utter = new SpeechSynthesisUtterance('1');
utter.onend = t.step_func_done();
const utter = new SpeechSynthesisUtterance('test');
utter.onerror = t.unreached_func('error event');
speechSynthesis.speak(utter);
utter.onstart = t.step_func(() => {
utter.onend = t.step_func_done();
});
}));
}, 'speechSynthesis.speak requires user activation');
}, 'speechSynthesis.speak() fires start and end events');
</script>