tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

file_setup.html (3843B)


      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">
     21  
     22 </div>
     23 <pre id="test">
     24 <script type="application/javascript">
     25 
     26 /** Test for Bug 525444 */
     27 
     28 ok(SpeechSynthesis, "SpeechSynthesis exists in global scope");
     29 ok(SpeechSynthesisVoice, "SpeechSynthesisVoice exists in global scope");
     30 ok(SpeechSynthesisErrorEvent, "SpeechSynthesisErrorEvent exists in global scope");
     31 ok(SpeechSynthesisEvent, "SpeechSynthesisEvent exists in global scope");
     32 
     33 // SpeechSynthesisUtterance is the only type that has a constructor
     34 //  and writable properties
     35 ok(SpeechSynthesisUtterance, "SpeechSynthesisUtterance exists in global scope");
     36 var ssu = new SpeechSynthesisUtterance("hello world");
     37 is(typeof ssu, "object", "SpeechSynthesisUtterance instance is an object");
     38 is(ssu.text, "hello world", "SpeechSynthesisUtterance.text is correct");
     39 is(ssu.volume, 1, "SpeechSynthesisUtterance.volume default is correct");
     40 is(ssu.rate, 1, "SpeechSynthesisUtterance.rate default is correct");
     41 is(ssu.pitch, 1, "SpeechSynthesisUtterance.pitch default is correct");
     42 ssu.lang = "he-IL";
     43 ssu.volume = 0.5;
     44 ssu.rate = 2.0;
     45 ssu.pitch = 1.5;
     46 is(ssu.lang, "he-IL", "SpeechSynthesisUtterance.lang is correct");
     47 is(ssu.volume, 0.5,  "SpeechSynthesisUtterance.volume is correct");
     48 is(ssu.rate, 2.0,  "SpeechSynthesisUtterance.rate is correct");
     49 is(ssu.pitch, 1.5,  "SpeechSynthesisUtterance.pitch is correct");
     50 
     51 // Assign a rate that is out of bounds
     52 ssu.rate = 20;
     53 is(ssu.rate, 10, "SpeechSynthesisUtterance.rate enforces max of 10");
     54 ssu.rate = 0;
     55 is(ssu.rate.toPrecision(1), "0.1", "SpeechSynthesisUtterance.rate enforces min of 0.1");
     56 
     57 // Assign a volume which is out of bounds
     58 ssu.volume = 2;
     59 is(ssu.volume, 1, "SpeechSynthesisUtterance.volume enforces max of 1");
     60 ssu.volume = -1;
     61 is(ssu.volume, 0, "SpeechSynthesisUtterance.volume enforces min of 0");
     62 
     63 // Assign a pitch which is out of bounds
     64 ssu.pitch = 2.1;
     65 is(ssu.pitch, 2, "SpeechSynthesisUtterance.pitch enforces max of 2");
     66 ssu.pitch = -1;
     67 is(ssu.pitch, 0, "SpeechSynthesisUtterance.pitch enforces min of 0");
     68 
     69 // Test for singleton instance hanging off of window.
     70 ok(speechSynthesis, "speechSynthesis exists in global scope");
     71 is(typeof speechSynthesis, "object", "speechSynthesis instance is an object");
     72 is(typeof speechSynthesis.speak, "function", "speechSynthesis.speak is a function");
     73 is(typeof speechSynthesis.cancel, "function", "speechSynthesis.cancel is a function");
     74 is(typeof speechSynthesis.pause, "function", "speechSynthesis.pause is a function");
     75 is(typeof speechSynthesis.resume, "function", "speechSynthesis.resume is a function");
     76 is(typeof speechSynthesis.getVoices, "function", "speechSynthesis.getVoices is a function");
     77 
     78 is(typeof speechSynthesis.pending, "boolean", "speechSynthesis.pending is a boolean");
     79 is(typeof speechSynthesis.speaking, "boolean", "speechSynthesis.speaking is a boolean");
     80 is(typeof speechSynthesis.paused, "boolean", "speechSynthesis.paused is a boolean");
     81 
     82 var voices1 = speechSynthesis.getVoices();
     83 var voices2 = speechSynthesis.getVoices();
     84 
     85 ok(!!voices1.length, "More than one voice found");
     86 ok(voices1.length == voices2.length, "Voice count matches");
     87 
     88 for (var i in voices1) {
     89  ok(voices1[i] == voices2[i], "Voice instance matches");
     90 }
     91 
     92 SimpleTest.finish();
     93 </script>
     94 </pre>
     95 </body>
     96 </html>