| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | |
| 2 <html> | |
| 3 <head> | |
| 4 <meta charset="utf-8"> | |
| 5 <script src="../../resources/js-test.js"></script> | |
| 6 </head> | |
| 7 <body> | |
| 8 <script type="text/javascript"> | |
| 9 description('Tests for language-specific results and language inheritance in spe
ech buttons.'); | |
| 10 | |
| 11 // Note: test cases are sequential to ensure that no new recognition starts when
another recognition recording is active. | |
| 12 function onChangeNone() { | |
| 13 shouldBeEqualToString('document.getElementById("speechInputNone").value', 'e
rror: no result found for language \'\''); | |
| 14 setTimeout(function() { speechButtonClick('speechInputElement'); }, 50); | |
| 15 } | |
| 16 | |
| 17 function onChangeElement() { | |
| 18 shouldBeEqualToString('document.getElementById("speechInputElement").value',
'Pictures of the moon'); | |
| 19 setTimeout(function() { speechButtonClick('speechInputInherited'); }, 50); | |
| 20 } | |
| 21 | |
| 22 function onChangeInherited() { | |
| 23 shouldBeEqualToString('document.getElementById("speechInputInherited").value
', '月の写真'); | |
| 24 finishJSTest(); | |
| 25 } | |
| 26 | |
| 27 function speechButtonClick(elementId) { | |
| 28 var element = document.getElementById(elementId); | |
| 29 var x = element.offsetLeft + element.offsetWidth - 4; | |
| 30 var y = element.offsetTop + element.offsetHeight / 2; | |
| 31 eventSender.mouseMoveTo(x, y); | |
| 32 eventSender.mouseDown(); | |
| 33 eventSender.mouseUp(); | |
| 34 } | |
| 35 | |
| 36 function run() { | |
| 37 if (window.testRunner && window.eventSender) { | |
| 38 testRunner.addMockSpeechInputResult('Pictures of the moon', 1.0, 'en-GB'
); | |
| 39 testRunner.addMockSpeechInputResult('月の写真', 1.0, 'ja'); | |
| 40 speechButtonClick('speechInputNone'); | |
| 41 } | |
| 42 } | |
| 43 | |
| 44 window.onload = run; | |
| 45 window.jsTestIsAsync = true; | |
| 46 </script> | |
| 47 <input id="speechInputNone" x-webkit-speech onwebkitspeechchange="onChangeNone()
"> | |
| 48 <input id="speechInputElement" x-webkit-speech onwebkitspeechchange="onChangeEle
ment()" lang="en-GB"> | |
| 49 <div lang="ja"> <input id="speechInputInherited" x-webkit-speech onwebkitspeechc
hange="onChangeInherited()"> </div> | |
| 50 </body> | |
| 51 </html> | |
| OLD | NEW |