Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1438)

Unified Diff: content/browser/speech/speech_recognition_browsertest.cc

Issue 2675713002: Switch Speech Recognition to asynchronous callback-based AudioManager interactions. (Closed)
Patch Set: review comments addressed Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/speech/speech_recognition_browsertest.cc
diff --git a/content/browser/speech/speech_recognition_browsertest.cc b/content/browser/speech/speech_recognition_browsertest.cc
index 7ddd4ee06dd355e59ceb78eba3d22c6973140afd..32fb5dea3917a69036289dceedd1d9bf787c237c 100644
--- a/content/browser/speech/speech_recognition_browsertest.cc
+++ b/content/browser/speech/speech_recognition_browsertest.cc
@@ -27,6 +27,7 @@
#include "content/public/test/test_utils.h"
#include "content/shell/browser/shell.h"
#include "content/test/mock_google_streaming_server.h"
+#include "media/audio/audio_system_impl.h"
#include "media/audio/mock_audio_manager.h"
#include "media/audio/test_audio_input_controller_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -122,16 +123,20 @@ class SpeechRecognitionBrowserTest :
ASSERT_TRUE(SpeechRecognitionManagerImpl::GetInstance());
media::AudioManager::StartHangMonitorIfNeeded(
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO));
- SpeechRecognizerImpl::SetAudioManagerForTesting(new media::MockAudioManager(
+ audio_manager_.reset(new media::MockAudioManager(
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)));
+ audio_manager_->SetInputStreamParameters(
+ media::AudioParameters::UnavailableDeviceParams());
+ audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get());
+ SpeechRecognizerImpl::SetAudioSystemForTesting(audio_system_.get());
}
void TearDownOnMainThread() override {
- SpeechRecognizerImpl::SetAudioManagerForTesting(NULL);
+ SpeechRecognizerImpl::SetAudioSystemForTesting(nullptr);
}
void TearDownInProcessBrowserTestFixture() override {
- test_audio_input_controller_factory_.set_delegate(NULL);
+ test_audio_input_controller_factory_.set_delegate(nullptr);
mock_streaming_server_.reset();
}
@@ -189,6 +194,8 @@ class SpeechRecognitionBrowserTest :
return result;
}
+ media::MockAudioManager::UniquePtr audio_manager_;
+ std::unique_ptr<media::AudioSystem> audio_system_;
StreamingServerState streaming_server_state_;
std::unique_ptr<MockGoogleStreamingServer> mock_streaming_server_;
media::TestAudioInputControllerFactory test_audio_input_controller_factory_;

Powered by Google App Engine
This is Rietveld 408576698