<html>
  <head>
    <title>Speech input test</title>
    <script type="text/javascript">
      function onspeechresult(value) {
        if (value == "Pictures of the moon") {
          document.getElementById('status').innerHTML = 'PASS';
          document.location = '#pass';
        } else {
          document.location = '#fail';
        }
      }
      function run() {
        // Calculate a point inside the speech button and pass that to the
        // c++ test code through the URL fragment. This calculation must
        // get updated if the speech button rendering changes.
        var inputField = document.getElementById('inputField');
        var x = inputField.offsetLeft + inputField.offsetWidth - 10;
        var y = inputField.offsetTop + Math.floor(inputField.offsetHeight / 2);
        document.location = document.location + '#' + x + ',' + y;
      }
    </script>
  </head>
  <body onLoad="run()">
    <input id='inputField' speech webkitspeech
           onchange="onspeechresult(this.value);">
    <br>
    <div id="status">FAIL</div>
  </body>
</html>

<html>
  <head>
    <title>Speech input test</title>
    <script type="text/javascript">
      function onspeechresult(value) {
        if (value == "Pictures of the moon") {
          document.getElementById('status').innerHTML = 'PASS';
          document.location = '#pass';
        } else {
          document.location = '#fail';
        }
      }
      function run() {
        // Calculate a point inside the speech button and pass that to the
        // c++ test code through the URL fragment. This calculation must
        // get updated if the speech button rendering changes.
        var inputField = document.getElementById('inputField');
        var x = inputField.offsetLeft + inputField.offsetWidth - 10;
        var y = inputField.offsetTop + Math.floor(inputField.offsetHeight / 2);
        document.location = document.location + '#' + x + ',' + y;
      }
    </script>
  </head>
  <body onLoad="run()">
    <input id='inputField' webkitspeech x-webkit-speech
           onwebkitspeechchange="onspeechresult(this.value);"
           onchange="onspeechresult(this.value);">
    <br>
    <div id="status">FAIL</div>
  </body>
</html>

Update test data files in preparation to renaming the @webkitspeech attribute.
Update test data files in preparation to renaming the @webkitspeech attribute.

In webkit patch https://bugs.webkit.org/show_bug.cgi?id=46873 I'm renaming the
input element's @webkitspeech attribute to @x-webkit-speech. This chromium CL updates
the relevant test files with both the old and new attribute names so that they
won't break while the webkit change is being submitted.

I'm also adding an extra event handler for 'onwebkitspeechchange'. This event will be added to webkit shortly and I'm including it now to allow webkit rolls to go without issues. The old attribute and event handler will be removed after the webkit changes are rolled into DEPS.

BUG=53598
TEST=browser_tests --gtest_filter=SpeechInputBrowserTest.*

Review URL: http://codereview.chromium.org/3539006

git-svn-id: http://src.chromium.org/svn/trunk/src@61161 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

Former-commit-id: 40209a395bca69f68b1e04b1b51b1623ef325bb2