1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../resources/js-test.js"></script>
8 <div id=
"console"></div>
12 description("This tests that pausing/resuming speech jobs works as expected.");
14 if (window
.testRunner
)
15 testRunner
.waitUntilDone();
17 window
.internals
.enableMockSpeechSynthesizer(document
);
19 window
.jsTestIsAsync
= true;
21 var u
= new SpeechSynthesisUtterance("this is a test");
23 // Verify that callbacks and state are correct for paused and speaking states.
24 u
.onpause = function(event
) {
25 debug("On pause event received.");
26 shouldBeTrue("speechSynthesis.paused");
27 shouldBeTrue("speechSynthesis.speaking");
30 u
.onresume = function(event
) {
31 debug("On resume event received.");
32 shouldBeFalse("speechSynthesis.paused");
33 shouldBeTrue("speechSynthesis.speaking");
36 u
.onend = function(event
) {
37 debug("On end event received.");
38 shouldBeFalse("speechSynthesis.paused");
39 shouldBeFalse("speechSynthesis.speaking");
43 speechSynthesis
.speak(u
);
45 // Quickly pause and resume the speech job.
46 setTimeout("speechSynthesis.pause()", 1);
47 setTimeout("speechSynthesis.resume()", 2);