1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../../resources/js-test.js"></script>
7 <script type=
"text/javascript">
8 description('Test Speech JavaScript API errors');
11 // Check availability of constructors.
12 shouldBeTrue("'webkitSpeechRecognition' in self");
13 shouldBeFalse("webkitSpeechRecognition == null");
18 function setDefaultHandlers(r
) {
20 if (prop
.match('^on')) {
21 r
[prop
] = function() {
22 testFailed('unexpected ' + event
.type
+ ' event!');
29 function notAllowedTest() {
30 debug('\nnotAllowedTest():');
31 var r
= new webkitSpeechRecognition();
32 setDefaultHandlers(r
);
36 testRunner
.setMockSpeechRecognitionError("NotAllowedError", "not allowed");
38 // Check that we get an error event.
39 r
.onerror = function() {
41 shouldBe('count', '0');
43 shouldBeEqualToString('event.error', 'not-allowed');
44 shouldBeEqualToString('event.message', 'not allowed');
45 shouldBeEqualToString('event.type', 'error');
48 // Check that we get an end event after the error event.
49 r
.onend = function() {
51 shouldBe('count', '1');
57 window
.jsTestIsAsync
= true;