diff options
author | xians@chromium.org <xians@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-20 06:38:23 +0000 |
---|---|---|
committer | xians@chromium.org <xians@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-20 06:38:23 +0000 |
commit | 76f9f04ee46b731646f29e9dfb6dbba3fc878684 (patch) | |
tree | ead968bded0d412053f1af6177089a62c94522f2 /content/browser/speech/speech_recognizer_impl_unittest.cc | |
parent | 51445e340fc6255dc73303d11f9db4dcc69021ed (diff) | |
download | chromium_src-76f9f04ee46b731646f29e9dfb6dbba3fc878684.zip chromium_src-76f9f04ee46b731646f29e9dfb6dbba3fc878684.tar.gz chromium_src-76f9f04ee46b731646f29e9dfb6dbba3fc878684.tar.bz2 |
added device selection to web speech to use the correct device. Users should be able to choose which microphone to be used via UI.
BUG=112472
TEST=https://www.google.com/intl/en/chrome/demos/speech.html
verify we can use different device to do the speech recognition.
Review URL: https://chromiumcodereview.appspot.com/17377003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207328 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/speech/speech_recognizer_impl_unittest.cc')
-rw-r--r-- | content/browser/speech/speech_recognizer_impl_unittest.cc | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/content/browser/speech/speech_recognizer_impl_unittest.cc b/content/browser/speech/speech_recognizer_impl_unittest.cc index 058f87e..dcd4d5b 100644 --- a/content/browser/speech/speech_recognizer_impl_unittest.cc +++ b/content/browser/speech/speech_recognizer_impl_unittest.cc @@ -8,6 +8,7 @@ #include "content/browser/speech/google_one_shot_remote_engine.h" #include "content/browser/speech/speech_recognizer_impl.h" #include "content/public/browser/speech_recognition_event_listener.h" +#include "media/audio/audio_manager_base.h" #include "media/audio/fake_audio_input_stream.h" #include "media/audio/fake_audio_output_stream.h" #include "media/audio/mock_audio_manager.h" @@ -184,7 +185,7 @@ class SpeechRecognizerImplTest : public SpeechRecognitionEventListener, TEST_F(SpeechRecognizerImplTest, StopNoData) { // Check for callbacks when stopping record before any audio gets recorded. - recognizer_->StartRecognition(); + recognizer_->StartRecognition(media::AudioManagerBase::kDefaultDeviceId); recognizer_->StopAudioCapture(); base::MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(recognition_started_); @@ -197,7 +198,7 @@ TEST_F(SpeechRecognizerImplTest, StopNoData) { TEST_F(SpeechRecognizerImplTest, CancelNoData) { // Check for callbacks when canceling recognition before any audio gets // recorded. - recognizer_->StartRecognition(); + recognizer_->StartRecognition(media::AudioManagerBase::kDefaultDeviceId); recognizer_->AbortRecognition(); base::MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(recognition_started_); @@ -210,7 +211,7 @@ TEST_F(SpeechRecognizerImplTest, CancelNoData) { TEST_F(SpeechRecognizerImplTest, StopWithData) { // Start recording, give some data and then stop. This should wait for the // network callback to arrive before completion. - recognizer_->StartRecognition(); + recognizer_->StartRecognition(media::AudioManagerBase::kDefaultDeviceId); base::MessageLoop::current()->RunUntilIdle(); TestAudioInputController* controller = audio_input_controller_factory_.controller(); @@ -259,7 +260,7 @@ TEST_F(SpeechRecognizerImplTest, StopWithData) { TEST_F(SpeechRecognizerImplTest, CancelWithData) { // Start recording, give some data and then cancel. - recognizer_->StartRecognition(); + recognizer_->StartRecognition(media::AudioManagerBase::kDefaultDeviceId); base::MessageLoop::current()->RunUntilIdle(); TestAudioInputController* controller = audio_input_controller_factory_.controller(); @@ -280,7 +281,7 @@ TEST_F(SpeechRecognizerImplTest, CancelWithData) { TEST_F(SpeechRecognizerImplTest, ConnectionError) { // Start recording, give some data and then stop. Issue the network callback // with a connection error and verify that the recognizer bubbles the error up - recognizer_->StartRecognition(); + recognizer_->StartRecognition(media::AudioManagerBase::kDefaultDeviceId); base::MessageLoop::current()->RunUntilIdle(); TestAudioInputController* controller = audio_input_controller_factory_.controller(); @@ -318,7 +319,7 @@ TEST_F(SpeechRecognizerImplTest, ConnectionError) { TEST_F(SpeechRecognizerImplTest, ServerError) { // Start recording, give some data and then stop. Issue the network callback // with a 500 error and verify that the recognizer bubbles the error up - recognizer_->StartRecognition(); + recognizer_->StartRecognition(media::AudioManagerBase::kDefaultDeviceId); base::MessageLoop::current()->RunUntilIdle(); TestAudioInputController* controller = audio_input_controller_factory_.controller(); @@ -354,7 +355,7 @@ TEST_F(SpeechRecognizerImplTest, ServerError) { TEST_F(SpeechRecognizerImplTest, AudioControllerErrorNoData) { // Check if things tear down properly if AudioInputController threw an error. - recognizer_->StartRecognition(); + recognizer_->StartRecognition(media::AudioManagerBase::kDefaultDeviceId); base::MessageLoop::current()->RunUntilIdle(); TestAudioInputController* controller = audio_input_controller_factory_.controller(); @@ -371,7 +372,7 @@ TEST_F(SpeechRecognizerImplTest, AudioControllerErrorNoData) { TEST_F(SpeechRecognizerImplTest, AudioControllerErrorWithData) { // Check if things tear down properly if AudioInputController threw an error // after giving some audio data. - recognizer_->StartRecognition(); + recognizer_->StartRecognition(media::AudioManagerBase::kDefaultDeviceId); base::MessageLoop::current()->RunUntilIdle(); TestAudioInputController* controller = audio_input_controller_factory_.controller(); @@ -391,7 +392,7 @@ TEST_F(SpeechRecognizerImplTest, AudioControllerErrorWithData) { TEST_F(SpeechRecognizerImplTest, NoSpeechCallbackIssued) { // Start recording and give a lot of packets with audio samples set to zero. // This should trigger the no-speech detector and issue a callback. - recognizer_->StartRecognition(); + recognizer_->StartRecognition(media::AudioManagerBase::kDefaultDeviceId); base::MessageLoop::current()->RunUntilIdle(); TestAudioInputController* controller = audio_input_controller_factory_.controller(); @@ -417,7 +418,7 @@ TEST_F(SpeechRecognizerImplTest, NoSpeechCallbackNotIssued) { // and then some more with reasonably loud audio samples. This should be // treated as normal speech input and the no-speech detector should not get // triggered. - recognizer_->StartRecognition(); + recognizer_->StartRecognition(media::AudioManagerBase::kDefaultDeviceId); base::MessageLoop::current()->RunUntilIdle(); TestAudioInputController* controller = audio_input_controller_factory_.controller(); @@ -455,7 +456,7 @@ TEST_F(SpeechRecognizerImplTest, SetInputVolumeCallback) { // and then some more with reasonably loud audio samples. Check that we don't // get the callback during estimation phase, then get zero for the silence // samples and proper volume for the loud audio. - recognizer_->StartRecognition(); + recognizer_->StartRecognition(media::AudioManagerBase::kDefaultDeviceId); base::MessageLoop::current()->RunUntilIdle(); TestAudioInputController* controller = audio_input_controller_factory_.controller(); |