1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../../resources/js-test.js"></script>
7 <script type=
"text/javascript">
8 description('Test getting an exception when calling start() in the Speech JavaScript API');
11 // Check availability of constructors.
12 shouldBeTrue("'webkitSpeechRecognition' in self");
13 shouldBeFalse("webkitSpeechRecognition == null");
18 function doubleStart() {
19 debug('\ndoubleStart():');
20 evalAndLog("window.r = new webkitSpeechRecognition()");
22 // Set default handlers.
24 if (prop
.match('^on')) {
25 r
[prop
] = function() {
26 debug('on' + event
.type
);
28 if (event
.type
=== 'end') {
29 shouldNotThrow("r.start()");
30 evalAndLog("r.abort()");
32 r
.onend = function() {
37 shouldThrow("r.start()", '"InvalidStateError: Failed to execute \'start\' on \'SpeechRecognition\': recognition has already started."');
43 shouldNotThrow("r.start()");
44 shouldThrow("r.start()", '"InvalidStateError: Failed to execute \'start\' on \'SpeechRecognition\': recognition has already started."');
48 window
.jsTestIsAsync
= true;