OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | |
2 <html> | |
3 <head> | |
4 <script src="../js/resources/js-test-pre.js"></script> | |
5 </head> | |
6 <body id="body"> | |
7 | |
8 <div id="console"></div> | |
9 | |
10 <script> | |
11 | |
12 description("This tests that cancelling a speech job fires the right events. "); | |
13 | |
14 if (window.testRunner) | |
15 testRunner.waitUntilDone(); | |
16 | |
17 if (window.internals) | |
18 window.internals.enableMockSpeechSynthesizer(); | |
19 | |
20 window.jsTestIsAsync = true; | |
21 | |
22 var u = new SpeechSynthesisUtterance("this is a test"); | |
23 u.onstart = function(event) { | |
24 debug("Speech started"); | |
25 } | |
26 | |
27 u.onerror = function(event) { | |
28 debug("Speech error received because we cancelled and speech should no lo nger be pending."); | |
29 shouldBeFalse("speechSynthesis.pending"); | |
30 finishJSTest(); | |
31 } | |
32 | |
33 // Queue the first job which will start speaking immediately. | |
34 speechSynthesis.speak(u); | |
35 | |
36 // Make a few more jobs, so that when we cancel, it will clear the entire qu eue. | |
37 var u2 = new SpeechSynthesisUtterance("this is a second test"); | |
38 speechSynthesis.speak(u2); | |
39 | |
40 // Make a few more jobs, so that when we cancel, it will clear the entire qu eue. | |
41 var u3 = new SpeechSynthesisUtterance("this is a third test"); | |
42 speechSynthesis.speak(u3); | |
43 | |
44 // While we have two jobs, speech synthesis should report that it's pending. | |
45 shouldBeTrue("speechSynthesis.pending"); | |
46 | |
47 // Cancel speaking. | |
48 setTimeout("speechSynthesis.cancel()", "1"); | |
Tom Sepez
2013/05/10 16:40:19
nit: "1" vs. 1.
| |
49 | |
50 </script> | |
51 | |
52 <script src="../js/resources/js-test-post.js"></script> | |
53 </body> | |
54 </html> | |
OLD | NEW |