Chromium Code Reviews| 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="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
| 5 </head> | 5 </head> |
| 6 <body> | 6 <body> |
| 7 <script type="text/javascript"> | 7 <script type="text/javascript"> |
| 8 description('Tests for triggering speech directly in a <input type="text" spe ech>.'); | 8 description('Tests for triggering speech directly in a <input type="text" spe ech>.'); |
| 9 | 9 |
| 10 function startSpeechInput(id) { | 10 function startSpeechInput(id) { |
| 11 // Test that we can trigger speech with a method call to the input | 11 // Test that we can trigger speech with a method call to the input |
| 12 // element, so the user agent could toggle speech via a keypress, | 12 // element, so the user agent could toggle speech via a keypress, |
| 13 // for example. Select is required in order to ensure that the result | 13 // for example. Select is required in order to ensure that the result |
| 14 // will be set in input during the generated TextInput event. | 14 // will be set in input during the generated TextInput event. |
| 15 var input = document.getElementById(id); | 15 var input = document.getElementById(id); |
| 16 input.select(); | 16 input.select(); |
| 17 testRunner.startSpeechInput(input); | 17 console.log(internals); |
|
haraken
2014/03/04 06:19:41
Remove this.
hajimehoshi
2014/03/04 06:27:19
Oops, Done.
| |
| 18 internals.startSpeechInput(input); | |
| 18 } | 19 } |
| 19 | 20 |
| 20 function onWebkitSpeechChange() { | 21 function onWebkitSpeechChange() { |
| 21 shouldBeEqualToString('document.getElementById("speechInput").value', 'Pictu res of a sunset'); | 22 shouldBeEqualToString('document.getElementById("speechInput").value', 'Pictu res of a sunset'); |
| 22 finishJSTest(); | 23 finishJSTest(); |
| 23 } | 24 } |
| 24 | 25 |
| 25 function run() { | 26 function run() { |
| 26 if (window.testRunner && window.eventSender) { | 27 if (window.testRunner && window.eventSender) { |
| 27 testRunner.addMockSpeechInputResult('Pictures of a sunset', 1.0, ''); | 28 testRunner.addMockSpeechInputResult('Pictures of a sunset', 1.0, ''); |
| 28 startSpeechInput("speechInput"); | 29 startSpeechInput("speechInput"); |
| 29 } | 30 } |
| 30 } | 31 } |
| 31 | 32 |
| 32 window.onload = run; | 33 window.onload = run; |
| 33 window.jsTestIsAsync = true; | 34 window.jsTestIsAsync = true; |
| 34 </script> | 35 </script> |
| 35 <input id='speechInput' x-webkit-speech onwebkitspeechchange="onWebkitSpeechChan ge()"> | 36 <input id='speechInput' x-webkit-speech onwebkitspeechchange="onWebkitSpeechChan ge()"> |
| 36 </body> | 37 </body> |
| 37 </html> | 38 </html> |
| OLD | NEW |