OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
10 #include "chrome/browser/speech/speech_input_extension_api.h" | 10 #include "chrome/browser/speech/speech_input_extension_api.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 178 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
179 | 179 |
180 if (next_error_ != content::SPEECH_RECOGNITION_ERROR_NONE) { | 180 if (next_error_ != content::SPEECH_RECOGNITION_ERROR_NONE) { |
181 GetManager()->OnRecognitionError( | 181 GetManager()->OnRecognitionError( |
182 kSessionIDForTests, content::SpeechRecognitionError(next_error_)); | 182 kSessionIDForTests, content::SpeechRecognitionError(next_error_)); |
183 return; | 183 return; |
184 } | 184 } |
185 | 185 |
186 GetManager()->OnSoundEnd(kSessionIDForTests); | 186 GetManager()->OnSoundEnd(kSessionIDForTests); |
187 GetManager()->OnAudioEnd(kSessionIDForTests); | 187 GetManager()->OnAudioEnd(kSessionIDForTests); |
188 GetManager()->OnRecognitionResult(kSessionIDForTests, next_result_); | 188 content::SpeechRecognitionResults results; |
| 189 results.push_back(next_result_); |
| 190 GetManager()->OnRecognitionResults(kSessionIDForTests, results); |
189 GetManager()->OnRecognitionEnd(kSessionIDForTests); | 191 GetManager()->OnRecognitionEnd(kSessionIDForTests); |
190 } | 192 } |
191 | 193 |
192 // Every test should leave the manager in the idle state when finished. | 194 // Every test should leave the manager in the idle state when finished. |
193 IN_PROC_BROWSER_TEST_F(SpeechInputExtensionApiTest, StartStopTest) { | 195 IN_PROC_BROWSER_TEST_F(SpeechInputExtensionApiTest, StartStopTest) { |
194 AutoManagerHook hook(this); | 196 AutoManagerHook hook(this); |
195 | 197 |
196 SetRecognitionDelay(kDontDispatchCall); | 198 SetRecognitionDelay(kDontDispatchCall); |
197 ASSERT_TRUE(RunExtensionTest("speech_input/start_stop")) << message_; | 199 ASSERT_TRUE(RunExtensionTest("speech_input/start_stop")) << message_; |
198 } | 200 } |
(...skipping 15 matching lines...) Expand all Loading... |
214 SetRecognitionResult(result); | 216 SetRecognitionResult(result); |
215 ASSERT_TRUE(RunExtensionTest("speech_input/recognition")) << message_; | 217 ASSERT_TRUE(RunExtensionTest("speech_input/recognition")) << message_; |
216 } | 218 } |
217 | 219 |
218 IN_PROC_BROWSER_TEST_F(SpeechInputExtensionApiTest, RecognitionError) { | 220 IN_PROC_BROWSER_TEST_F(SpeechInputExtensionApiTest, RecognitionError) { |
219 AutoManagerHook hook(this); | 221 AutoManagerHook hook(this); |
220 | 222 |
221 SetRecognitionError(content::SPEECH_RECOGNITION_ERROR_NETWORK); | 223 SetRecognitionError(content::SPEECH_RECOGNITION_ERROR_NETWORK); |
222 ASSERT_TRUE(RunExtensionTest("speech_input/recognition_error")) << message_; | 224 ASSERT_TRUE(RunExtensionTest("speech_input/recognition_error")) << message_; |
223 } | 225 } |
OLD | NEW |