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 content::SpeechRecognitionResults results; | 188 GetManager()->OnRecognitionResult(kSessionIDForTests, next_result_); |
189 results.push_back(next_result_); | |
190 GetManager()->OnRecognitionResults(kSessionIDForTests, results); | |
191 GetManager()->OnRecognitionEnd(kSessionIDForTests); | 189 GetManager()->OnRecognitionEnd(kSessionIDForTests); |
192 } | 190 } |
193 | 191 |
194 // Every test should leave the manager in the idle state when finished. | 192 // Every test should leave the manager in the idle state when finished. |
195 IN_PROC_BROWSER_TEST_F(SpeechInputExtensionApiTest, StartStopTest) { | 193 IN_PROC_BROWSER_TEST_F(SpeechInputExtensionApiTest, StartStopTest) { |
196 AutoManagerHook hook(this); | 194 AutoManagerHook hook(this); |
197 | 195 |
198 SetRecognitionDelay(kDontDispatchCall); | 196 SetRecognitionDelay(kDontDispatchCall); |
199 ASSERT_TRUE(RunExtensionTest("speech_input/start_stop")) << message_; | 197 ASSERT_TRUE(RunExtensionTest("speech_input/start_stop")) << message_; |
200 } | 198 } |
(...skipping 15 matching lines...) Expand all Loading... |
216 SetRecognitionResult(result); | 214 SetRecognitionResult(result); |
217 ASSERT_TRUE(RunExtensionTest("speech_input/recognition")) << message_; | 215 ASSERT_TRUE(RunExtensionTest("speech_input/recognition")) << message_; |
218 } | 216 } |
219 | 217 |
220 IN_PROC_BROWSER_TEST_F(SpeechInputExtensionApiTest, RecognitionError) { | 218 IN_PROC_BROWSER_TEST_F(SpeechInputExtensionApiTest, RecognitionError) { |
221 AutoManagerHook hook(this); | 219 AutoManagerHook hook(this); |
222 | 220 |
223 SetRecognitionError(content::SPEECH_RECOGNITION_ERROR_NETWORK); | 221 SetRecognitionError(content::SPEECH_RECOGNITION_ERROR_NETWORK); |
224 ASSERT_TRUE(RunExtensionTest("speech_input/recognition_error")) << message_; | 222 ASSERT_TRUE(RunExtensionTest("speech_input/recognition_error")) << message_; |
225 } | 223 } |
OLD | NEW |