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="../js/resources/js-test-pre.js"></script> | 4 <script src="../js/resources/js-test-pre.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <script type="text/javascript"> | 7 <script type="text/javascript"> |
8 description('Tests for the onspeechchange event with <input type="text" speec h>.'); | 8 description('Tests for the onspeechchange event with <input type="text" speec h>.'); |
9 | 9 |
10 function onSpeechChange() { | 10 function onSpeechChange() { |
arv (Not doing code reviews)
2013/08/05 15:15:28
Can you get rid of the deprecated window.event?
v
do-not-use
2013/08/05 15:27:45
This does not seem to work. There is apparently no
do-not-use
2013/08/05 15:27:45
This does not seem to work. There is apparently no
arv (Not doing code reviews)
2013/08/05 15:36:00
Did you update the inline event handler attribute?
| |
11 shouldBeEqualToString('document.getElementById("speechInput").value', 'Green eggs and ham'); | 11 shouldBeEqualToString('document.getElementById("speechInput").value', 'Green eggs and ham'); |
12 shouldEvaluateTo('window.event.results.length', 3); | 12 shouldEvaluateTo('window.event.results.length', 3); |
13 shouldBeEqualToString('window.event.results[0].utterance', 'Green eggs and h am'); | 13 shouldBeEqualToString('window.event.results[0].utterance', 'Green eggs and h am'); |
14 shouldEvaluateTo('window.event.results[0].confidence', 0.8); | 14 shouldEvaluateTo('window.event.results[0].confidence', 0.8); |
15 shouldBeEqualToString('window.event.results[1].utterance', 'Green x and ham' ); | 15 shouldBeEqualToString('window.event.results[1].utterance', 'Green x and ham' ); |
16 shouldEvaluateTo('window.event.results[1].confidence', 0.5); | 16 shouldEvaluateTo('window.event.results[1].confidence', 0.5); |
17 shouldBeEqualToString('window.event.results[2].utterance', '3 x and am'); | 17 shouldBeEqualToString('window.event.results[2].utterance', '3 x and am'); |
18 shouldEvaluateTo('window.event.results[2].confidence', 0.2); | 18 shouldEvaluateTo('window.event.results[2].confidence', 0.2); |
19 shouldBeNull("window.event.results.item(-1)"); | |
19 finishJSTest(); | 20 finishJSTest(); |
20 } | 21 } |
21 | 22 |
22 function run() { | 23 function run() { |
23 if (window.testRunner && window.eventSender) { | 24 if (window.testRunner && window.eventSender) { |
24 testRunner.addMockSpeechInputResult('Green eggs and ham', 0.8, ''); | 25 testRunner.addMockSpeechInputResult('Green eggs and ham', 0.8, ''); |
25 testRunner.addMockSpeechInputResult('Green x and ham', 0.5, ''); | 26 testRunner.addMockSpeechInputResult('Green x and ham', 0.5, ''); |
26 testRunner.addMockSpeechInputResult('3 x and am', 0.2, ''); | 27 testRunner.addMockSpeechInputResult('3 x and am', 0.2, ''); |
27 | 28 |
28 // Clicking the speech button should fill in mock speech-recognized text . | 29 // Clicking the speech button should fill in mock speech-recognized text . |
29 var input = document.getElementById('speechInput'); | 30 var input = document.getElementById('speechInput'); |
30 var x = input.offsetLeft + input.offsetWidth - 4; | 31 var x = input.offsetLeft + input.offsetWidth - 4; |
31 var y = input.offsetTop + input.offsetHeight / 2; | 32 var y = input.offsetTop + input.offsetHeight / 2; |
32 eventSender.mouseMoveTo(x, y); | 33 eventSender.mouseMoveTo(x, y); |
33 eventSender.mouseDown(); | 34 eventSender.mouseDown(); |
34 eventSender.mouseUp(); | 35 eventSender.mouseUp(); |
35 } | 36 } |
36 } | 37 } |
37 | 38 |
38 window.onload = run; | 39 window.onload = run; |
39 window.jsTestIsAsync = true; | 40 window.jsTestIsAsync = true; |
40 </script> | 41 </script> |
41 <script src="../js/resources/js-test-post.js"></script> | 42 <script src="../js/resources/js-test-post.js"></script> |
42 <input id='speechInput' x-webkit-speech onwebkitspeechchange="onSpeechChange()"> | 43 <input id='speechInput' x-webkit-speech onwebkitspeechchange="onSpeechChange()"> |
43 </body> | 44 </body> |
44 </html> | 45 </html> |
OLD | NEW |