Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=525444
5 -->
6 <head>
7 <meta charset="utf-8">
8 <title>Test for Bug 525444: Web Speech API check all classes are present</title>
9 <script type="application/javascript">
10 window.SimpleTest = parent.SimpleTest;
11 window.is = parent.is;
12 window.isnot = parent.isnot;
13 window.ok = parent.ok;
14 </script>
15 <script type="application/javascript" src="common.js"></script>
16 </head>
17 <body>
18 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=650295">Mozilla Bug 650295</a>
19 <p id="display"></p>
20 <div id="content" style="display: none">
22 </div>
23 <pre id="test">
24 <script type="application/javascript">
26 /** Test for Bug 525444 **/
28 synthAddVoice('TestSpeechServiceNoAudio', 'Bob Marley', 'en-JM', true);
29 synthAddVoice('TestSpeechServiceNoAudio', 'Amy Winehouse', 'en-GB', true);
30 synthAddVoice('TestSpeechServiceNoAudio', 'Leonard Cohen', 'en-CA', true);
31 synthAddVoice('TestSpeechServiceNoAudio', 'Celine Dion', 'fr-CA', true);
32 synthAddVoice('TestSpeechServiceNoAudio', 'Julieta Venegas', 'es-MX', true);
34 ok(SpeechSynthesis, "SpeechSynthesis exists in global scope");
35 ok(SpeechSynthesisVoice, "SpeechSynthesisVoice exists in global scope");
36 ok(SpeechSynthesisEvent, "SpeechSynthesisEvent exists in global scope");
38 // SpeechSynthesisUtterance is the only type that has a constructor
39 // and writable properties
40 ok(SpeechSynthesisUtterance, "SpeechSynthesisUtterance exists in global scope");
41 var ssu = new SpeechSynthesisUtterance("hello world");
42 is(typeof ssu, "object", "SpeechSynthesisUtterance instance is an object");
43 is(ssu.text, "hello world", "SpeechSynthesisUtterance.text is correct");
44 is(ssu.volume, 1, "SpeechSynthesisUtterance.volume default is correct");
45 is(ssu.rate, 1, "SpeechSynthesisUtterance.rate default is correct");
46 is(ssu.pitch, 1, "SpeechSynthesisUtterance.pitch default is correct");
47 ssu.lang = "he-IL";
48 ssu.volume = 0.5;
49 ssu.rate = 2.0;
50 ssu.pitch = 1.5;
51 is(ssu.lang, "he-IL", "SpeechSynthesisUtterance.lang is correct");
52 is(ssu.volume, 0.5, "SpeechSynthesisUtterance.volume is correct");
53 is(ssu.rate, 2.0, "SpeechSynthesisUtterance.rate is correct");
54 is(ssu.pitch, 1.5, "SpeechSynthesisUtterance.pitch is correct");
56 // Test for singleton instance hanging off of window.
57 ok(speechSynthesis, "speechSynthesis exists in global scope");
58 is(typeof speechSynthesis, "object", "speechSynthesis instance is an object");
59 is(typeof speechSynthesis.speak, "function", "speechSynthesis.speak is a function");
60 is(typeof speechSynthesis.cancel, "function", "speechSynthesis.cancel is a function");
61 is(typeof speechSynthesis.pause, "function", "speechSynthesis.pause is a function");
62 is(typeof speechSynthesis.resume, "function", "speechSynthesis.resume is a function");
63 is(typeof speechSynthesis.getVoices, "function", "speechSynthesis.getVoices is a function");
65 is(typeof speechSynthesis.pending, "boolean", "speechSynthesis.pending is a boolean");
66 is(typeof speechSynthesis.speaking, "boolean", "speechSynthesis.speaking is a boolean");
67 is(typeof speechSynthesis.paused, "boolean", "speechSynthesis.paused is a boolean");
69 var voices1 = speechSynthesis.getVoices();
70 var voices2 = speechSynthesis.getVoices();
72 ok(voices1.length == voices2.length, "Voice count matches");
74 for (var i in voices1) {
75 ok(voices1[i] == voices2[i], "Voice instance matches");
76 }
78 synthCleanup();
80 SimpleTest.finish();
81 </script>
82 </pre>
83 </body>
84 </html>