| 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 getting an exception when calling start() in the Speech JavaSc
ript API'); | 8 description('Test getting an exception when calling start() in the Speech JavaSc
ript API'); |
| 9 | 9 |
| 10 function run() { | 10 function run() { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 if (prop.match('^on')) { | 24 if (prop.match('^on')) { |
| 25 r[prop] = function() { | 25 r[prop] = function() { |
| 26 debug('on' + event.type); | 26 debug('on' + event.type); |
| 27 | 27 |
| 28 if (event.type === 'end') { | 28 if (event.type === 'end') { |
| 29 shouldNotThrow("r.start()"); | 29 shouldNotThrow("r.start()"); |
| 30 evalAndLog("r.abort()"); | 30 evalAndLog("r.abort()"); |
| 31 | 31 |
| 32 r.onend = function() { | 32 r.onend = function() { |
| 33 debug('onend'); | 33 debug('onend'); |
| 34 finishJSTest(); | 34 serviceURIInvalid(); |
| 35 } | 35 } |
| 36 } else { | 36 } else { |
| 37 shouldThrow("r.start()", '"InvalidStateError: Failed to exec
ute \'start\' on \'SpeechRecognition\': recognition has already started."'); | 37 shouldThrow("r.start()", '"InvalidStateError: Failed to exec
ute \'start\' on \'SpeechRecognition\': recognition has already started."'); |
| 38 } | 38 } |
| 39 } | 39 } |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 | 42 |
| 43 shouldNotThrow("r.start()"); | 43 shouldNotThrow("r.start()"); |
| 44 shouldThrow("r.start()", '"InvalidStateError: Failed to execute \'start\' on
\'SpeechRecognition\': recognition has already started."'); | 44 shouldThrow("r.start()", '"InvalidStateError: Failed to execute \'start\' on
\'SpeechRecognition\': recognition has already started."'); |
| 45 } | 45 } |
| 46 | 46 |
| 47 function serviceURIInvalid() { |
| 48 debug('\nserviceURIInvalid():'); |
| 49 evalAndLog("window.r = new webkitSpeechRecognition()"); |
| 50 evalAndLog("r.serviceURI = 'http:/:/:/badurl'"); |
| 51 |
| 52 shouldThrow("r.start()", '"SyntaxError: Failed to execute \'start\' on \'Spe
echRecognition\': serviceURI is neither empty nor a valid URL."'); |
| 53 evalAndLog("r.abort()"); |
| 54 finishJSTest(); |
| 55 } |
| 56 |
| 47 window.onload = run; | 57 window.onload = run; |
| 48 window.jsTestIsAsync = true; | 58 window.jsTestIsAsync = true; |
| 49 </script> | 59 </script> |
| 50 </body> | 60 </body> |
| 51 </html> | 61 </html> |
| 52 | |
| OLD | NEW |