diff options
author | satish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-10 22:41:21 +0000 |
---|---|---|
committer | satish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-10 22:41:21 +0000 |
commit | 557d4e83efbdae5bd4fa8564f5db9b03bb9d691c (patch) | |
tree | 8c95528cf8a740ca325a933b810b09cf53b7935c /media/audio/audio_input_controller.cc | |
parent | 3355fbdbc15c9d66cc5d74004f8cdc243afa4054 (diff) | |
download | chromium_src-557d4e83efbdae5bd4fa8564f5db9b03bb9d691c.zip chromium_src-557d4e83efbdae5bd4fa8564f5db9b03bb9d691c.tar.gz chromium_src-557d4e83efbdae5bd4fa8564f5db9b03bb9d691c.tar.bz2 |
Allow unit tests to use a mock audio input controller.
This is modelled after chrome/common/net/test_url_fetcher_factory.h. Using this mock unit tests can stub out the audio recording part and test the consumer of the audio data.
I have also added a new media_test_support target to media.gyp, this will be used in subsequent CLs for testing speech input code.
BUG=none
TEST=none, this code will get used in future unit tests
Review URL: http://codereview.chromium.org/3148003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55627 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/audio_input_controller.cc')
-rw-r--r-- | media/audio/audio_input_controller.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/media/audio/audio_input_controller.cc b/media/audio/audio_input_controller.cc index f94c0042..d64fb70 100644 --- a/media/audio/audio_input_controller.cc +++ b/media/audio/audio_input_controller.cc @@ -15,6 +15,9 @@ const int kMaxSamplesPerPacket = kMaxSampleRate; namespace media { +// static +AudioInputController::Factory* AudioInputController::factory_ = NULL; + AudioInputController::AudioInputController(EventHandler* handler) : handler_(handler), stream_(NULL), @@ -40,6 +43,11 @@ scoped_refptr<AudioInputController> AudioInputController::Create( (samples_per_packet > kMaxSamplesPerPacket) || (samples_per_packet < 0)) return NULL; + if (factory_) { + return factory_->Create(event_handler, format, channels, sample_rate, + bits_per_sample, samples_per_packet); + } + scoped_refptr<AudioInputController> controller = new AudioInputController( event_handler); |