| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 167 |
| 168 void SpeechInputExtensionApiTest::StopRecording(bool recognition_failed) { | 168 void SpeechInputExtensionApiTest::StopRecording(bool recognition_failed) { |
| 169 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 169 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 170 recognizer_is_valid_ = false; | 170 recognizer_is_valid_ = false; |
| 171 } | 171 } |
| 172 | 172 |
| 173 void SpeechInputExtensionApiTest::ProvideResults(int session_id) { | 173 void SpeechInputExtensionApiTest::ProvideResults(int session_id) { |
| 174 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 174 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 175 | 175 |
| 176 if (next_error_ != content::SPEECH_RECOGNITION_ERROR_NONE) { | 176 if (next_error_ != content::SPEECH_RECOGNITION_ERROR_NONE) { |
| 177 GetManager()->OnRecognitionError(session_id, next_error_); | 177 GetManager()->OnRecognitionError( |
| 178 session_id, content::SpeechRecognitionError(next_error_)); |
| 178 return; | 179 return; |
| 179 } | 180 } |
| 180 | 181 |
| 181 GetManager()->OnSoundEnd(session_id); | 182 GetManager()->OnSoundEnd(session_id); |
| 182 GetManager()->OnAudioEnd(session_id); | 183 GetManager()->OnAudioEnd(session_id); |
| 183 GetManager()->OnRecognitionResult(session_id, next_result_); | 184 GetManager()->OnRecognitionResult(session_id, next_result_); |
| 184 } | 185 } |
| 185 | 186 |
| 186 // Every test should leave the manager in the idle state when finished. | 187 // Every test should leave the manager in the idle state when finished. |
| 187 IN_PROC_BROWSER_TEST_F(SpeechInputExtensionApiTest, StartStopTest) { | 188 IN_PROC_BROWSER_TEST_F(SpeechInputExtensionApiTest, StartStopTest) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 208 SetRecognitionResult(result); | 209 SetRecognitionResult(result); |
| 209 ASSERT_TRUE(RunExtensionTest("speech_input/recognition")) << message_; | 210 ASSERT_TRUE(RunExtensionTest("speech_input/recognition")) << message_; |
| 210 } | 211 } |
| 211 | 212 |
| 212 IN_PROC_BROWSER_TEST_F(SpeechInputExtensionApiTest, RecognitionError) { | 213 IN_PROC_BROWSER_TEST_F(SpeechInputExtensionApiTest, RecognitionError) { |
| 213 AutoManagerHook hook(this); | 214 AutoManagerHook hook(this); |
| 214 | 215 |
| 215 SetRecognitionError(content::SPEECH_RECOGNITION_ERROR_NETWORK); | 216 SetRecognitionError(content::SPEECH_RECOGNITION_ERROR_NETWORK); |
| 216 ASSERT_TRUE(RunExtensionTest("speech_input/recognition_error")) << message_; | 217 ASSERT_TRUE(RunExtensionTest("speech_input/recognition_error")) << message_; |
| 217 } | 218 } |
| OLD | NEW |