Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / speechsynthesis / speech-synthesis-pause-resume.html
blob69517ae23b87c4a3bae094b01d0a4a77dad0ec50
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body id="body">
8 <div id="console"></div>
10 <script>
12 description("This tests that pausing/resuming speech jobs works as expected.");
14 if (window.testRunner)
15 testRunner.waitUntilDone();
16 if (window.internals)
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");
40 finishJSTest();
43 speechSynthesis.speak(u);
45 // Quickly pause and resume the speech job.
46 setTimeout("speechSynthesis.pause()", 1);
47 setTimeout("speechSynthesis.resume()", 2);
49 </script>
51 </body>
52 </html>