1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
4 <script src="../js/resources/js-test-pre.js"></script>
7 <script type="text/javascript">
8 description('Tests for speech button click with <input type="text" speech>.');
10 function startSpeechInput(id) {
11 // Clicking the speech button should fill in mock speech-recognized text.
12 var input = document.getElementById(id);
13 var isRTL = input.dir == 'rtl';
16 x = input.offsetLeft + 4;
18 x = input.offsetLeft + input.offsetWidth - 4;
19 var y = input.offsetTop + input.offsetHeight / 2;
20 if (!isRTL && input.style.paddingRight.length)
21 x -= parseInt(input.style.paddingRight.substr(0, input.style.paddingRight.length - 2));
22 else if (isRTL && input.style.paddingLeft.length)
23 x += parseInt(input.style.paddingLeft.substr(0, input.style.paddingLeft.length - 2));
24 eventSender.mouseMoveTo(x, y);
25 eventSender.mouseDown();
26 eventSender.mouseUp();
30 function onWebkitSpeechChange() {
31 shouldBeEqualToString('document.getElementById("speechInput' + testIndex + '").value', 'Pictures of the moon');
37 setTimeout(function() {
38 startSpeechInput("speechInput" + testIndex);
43 if (window.layoutTestController && window.eventSender) {
44 layoutTestController.addMockSpeechInputResult('Pictures of the moon', 1.0, '');
45 startSpeechInput("speechInput" + testIndex);
50 window.jsTestIsAsync = true;
52 <script src="../js/resources/js-test-post.js"></script>
53 <input id='speechInput1' x-webkit-speech onwebkitspeechchange="onWebkitSpeechChange()">
54 <input id='speechInput2' x-webkit-speech onwebkitspeechchange="onWebkitSpeechChange()" dir="rtl">
55 <input id='speechInput3' x-webkit-speech onwebkitspeechchange="onWebkitSpeechChange()" style="padding:5px 10px">
56 <input id='speechInput4' x-webkit-speech onwebkitspeechchange="onWebkitSpeechChange()" style="padding:5px 10px" dir="rtl">