| OLD | NEW |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
| 5 </head> | 5 </head> |
| 6 <body> | 6 <body> |
| 7 <script type="text/javascript"> | 7 <script type="text/javascript"> |
| 8 description('Test basic interaction with the Speech JavaScript API'); | 8 description('Test basic interaction with the Speech JavaScript API'); |
| 9 | 9 |
| 10 function run() { | 10 function run() { |
| 11 // Check availability of constructors. | 11 // Check availability of constructors. |
| 12 shouldBeTrue("'webkitSpeechRecognition' in self"); | 12 shouldBeTrue("'webkitSpeechRecognition' in self"); |
| 13 shouldBeFalse("webkitSpeechRecognition == null"); | 13 shouldBeFalse("webkitSpeechRecognition == null"); |
| 14 | 14 |
| 15 oneMatchTest(); | 15 nullServiceURI(); |
| 16 } |
| 17 |
| 18 function nullServiceURI(){ |
| 19 debug('\nnullServiceURI():'); |
| 20 evalAndLog("window.r = new webkitSpeechRecognition()"); |
| 21 |
| 22 r.onend = function() { |
| 23 debug('onend'); |
| 24 invalidServiceURI(); |
| 25 } |
| 26 |
| 27 shouldNotThrow("r.start()"); |
| 28 } |
| 29 |
| 30 function invalidServiceURI(){ |
| 31 debug('\ninvalidServiceURI():'); |
| 32 evalAndLog("window.r = new webkitSpeechRecognition()"); |
| 33 evalAndLog("r.serviceURI = 'http:/:/:/badurl'"); |
| 34 |
| 35 r.onend = function() { |
| 36 debug('onend'); |
| 37 validServiceURI(); |
| 38 } |
| 39 |
| 40 shouldNotThrow("r.start()"); |
| 41 } |
| 42 |
| 43 function validServiceURI(){ |
| 44 debug('\nvalidServiceURI():'); |
| 45 evalAndLog("window.r = new webkitSpeechRecognition()"); |
| 46 evalAndLog("r.serviceURI = 'chrome://speech-recognition?foo=bar&client=com.e
xample'"); |
| 47 |
| 48 r.onend = function() { |
| 49 debug('onend'); |
| 50 oneMatchTest(); |
| 51 } |
| 52 |
| 53 shouldNotThrow("r.start()"); |
| 16 } | 54 } |
| 17 | 55 |
| 18 function oneMatchTest() { | 56 function oneMatchTest() { |
| 19 debug('\noneMatchTest():'); | 57 debug('\noneMatchTest():'); |
| 20 var r = new webkitSpeechRecognition(); | 58 var r = new webkitSpeechRecognition(); |
| 21 window.count = 0; | 59 window.count = 0; |
| 22 | 60 |
| 23 r.onstart = function() { debug('onstart'); shouldBe('count', '
0'); ++count; } | 61 r.onstart = function() { debug('onstart'); shouldBe('count', '
0'); ++count; } |
| 24 r.onaudiostart = function() { debug('onaudiostart'); shouldBe('count', '
1'); ++count; } | 62 r.onaudiostart = function() { debug('onaudiostart'); shouldBe('count', '
1'); ++count; } |
| 25 r.onsoundstart = function() { debug('onsoundstart'); shouldBe('count', '
2'); ++count; } | 63 r.onsoundstart = function() { debug('onsoundstart'); shouldBe('count', '
2'); ++count; } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 124 } |
| 87 | 125 |
| 88 r.start(); | 126 r.start(); |
| 89 } | 127 } |
| 90 | 128 |
| 91 window.onload = run; | 129 window.onload = run; |
| 92 window.jsTestIsAsync = true; | 130 window.jsTestIsAsync = true; |
| 93 </script> | 131 </script> |
| 94 </body> | 132 </body> |
| 95 </html> | 133 </html> |
| OLD | NEW |