| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"> |
| description('Tests for triggering speech directly in a <input type="text" speech>.'); |
| |
| function startSpeechInput(id) { |
| // Test that we can trigger speech with a method call to the input |
| // element, so the user agent could toggle speech via a keypress, |
| // for example. Select is required in order to ensure that the result |
| // will be set in input during the generated TextInput event. |
| var input = document.getElementById(id); |
| input.select(); |
| testRunner.startSpeechInput(input); |
| } |
| |
| function onWebkitSpeechChange() { |
| shouldBeEqualToString('document.getElementById("speechInput").value', 'Pictures of a sunset'); |
| finishJSTest(); |
| } |
| |
| function run() { |
| if (window.testRunner && window.eventSender) { |
| testRunner.addMockSpeechInputResult('Pictures of a sunset', 1.0, ''); |
| startSpeechInput("speechInput"); |
| } |
| } |
| |
| window.onload = run; |
| window.jsTestIsAsync = true; |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| <input id='speechInput' x-webkit-speech onwebkitspeechchange="onWebkitSpeechChange()"> |
| </body> |
| </html> |