| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="../../resources/js-test.js"></script> | |
| 5 </head> | |
| 6 <body> | |
| 7 <script type="text/javascript"> | |
| 8 description('Tests for the ontextInput event with <input type="text" speech>.
'); | |
| 9 | |
| 10 function onTextInput() { | |
| 11 shouldBeEqualToString('document.getElementById("speechInput").value', ''); | |
| 12 shouldBeEqualToString('window.event.data', 'Green eggs and ham'); | |
| 13 | |
| 14 // Set to undefined to make this test fail if it's implemented, so it can be
properly set to the correct value once it's available. | |
| 15 shouldBe('window.event.inputMethod', 'undefined'); | |
| 16 | |
| 17 finishJSTest(); | |
| 18 } | |
| 19 | |
| 20 function run() { | |
| 21 if (window.testRunner && window.eventSender) { | |
| 22 testRunner.addMockSpeechInputResult('Green eggs and ham', 0.8, ''); | |
| 23 testRunner.addMockSpeechInputResult('Green x and ham', 0.5, ''); | |
| 24 | |
| 25 // Clicking the speech button should fill in mock speech-recognized text
. | |
| 26 var input = document.getElementById('speechInput'); | |
| 27 input.addEventListener("textInput", onTextInput, false); | |
| 28 | |
| 29 var x = input.offsetLeft + input.offsetWidth - 4; | |
| 30 var y = input.offsetTop + input.offsetHeight / 2; | |
| 31 eventSender.mouseMoveTo(x, y); | |
| 32 eventSender.mouseDown(); | |
| 33 eventSender.mouseUp(); | |
| 34 } | |
| 35 } | |
| 36 | |
| 37 window.onload = run; | |
| 38 window.jsTestIsAsync = true; | |
| 39 </script> | |
| 40 <input id='speechInput' x-webkit-speech> | |
| 41 </body> | |
| 42 </html> | |
| OLD | NEW |