diff options
author | satish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-28 08:47:09 +0000 |
---|---|---|
committer | satish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-28 08:47:09 +0000 |
commit | befab4b7c401a2368fe313db1be59c83626c6b36 (patch) | |
tree | 07abbabbe42a391265c21d0f843c86d122abec96 /chrome/test/data/speech | |
parent | 2ae27702b4bd9bf31a19024131ba701c9253297c (diff) | |
download | chromium_src-befab4b7c401a2368fe313db1be59c83626c6b36.zip chromium_src-befab4b7c401a2368fe313db1be59c83626c6b36.tar.gz chromium_src-befab4b7c401a2368fe313db1be59c83626c6b36.tar.bz2 |
Added grammar attribute to speech input.
In https://bugs.webkit.org/show_bug.cgi?id=48339 we added support for a 'x-webkit-grammar' attribute for speech input.
In this CL we receive that as a parameter to SpeechInputDispatcher::startRecognition() and pass it up to the
SpeechRecognitionRequest object which encodes and sends it as a url parameter to the server.
To aid in this I also moved the speech server URL from SpeechRecognizer.cc to SpeechRecognitionRequest.cc.
Also added a browser test for this attribute. It is marked as FLAKY now because the code is exactly the same as with
the TestBasicRecognition test in that file and that test is FLAKY now. Both are marked with the same bug and I will
remove the FLAKY_ prefix on both when the bug is closed.
BUG=none
TEST=browser_tests --gtest_filter=SpeechInputBrowserTest.GrammarAttribute
Review URL: http://codereview.chromium.org/4183002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64213 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/data/speech')
-rw-r--r-- | chrome/test/data/speech/grammar_attribute.html | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/chrome/test/data/speech/grammar_attribute.html b/chrome/test/data/speech/grammar_attribute.html new file mode 100644 index 0000000..84e3db06 --- /dev/null +++ b/chrome/test/data/speech/grammar_attribute.html @@ -0,0 +1,32 @@ +<html> + <head> + <title>Speech input with grammar attribute 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' x-webkit-speech + x-webkit-grammar="http://example.com/grammar.xml" + onwebkitspeechchange="onspeechresult(this.value);" + onchange="onspeechresult(this.value);"> + <br> + <div id="status">FAIL</div> + </body> +</html> |