Chromium Code Reviews| Index: media/audio/test_audio_input_controller_factory.h |
| diff --git a/media/audio/test_audio_input_controller_factory.h b/media/audio/test_audio_input_controller_factory.h |
| index 5e2633d39b963482f3e60e970d03ce520c017337..ad4b1e6f9788ba15f6270fe91f980319c78bbf84 100644 |
| --- a/media/audio/test_audio_input_controller_factory.h |
| +++ b/media/audio/test_audio_input_controller_factory.h |
| @@ -44,17 +44,29 @@ class TestAudioInputControllerFactory; |
| class TestAudioInputController : public AudioInputController { |
| public: |
| + class Delegate { |
| + public: |
| + virtual void TestAudioControllerOpened( |
| + TestAudioInputController* controller) = 0; |
| + virtual void TestAudioControllerClosed( |
| + TestAudioInputController* controller) = 0; |
| + }; |
| + |
| TestAudioInputController(TestAudioInputControllerFactory* factory, |
| AudioManager* audio_manager, |
| + AudioParameters audio_parameters, |
|
tommi (sloooow) - chröme
2012/07/11 11:12:30
nit: const AudioParameters&
Primiano Tucci (use gerrit)
2012/07/11 14:33:31
Done.
|
| EventHandler* event_handler, |
| SyncWriter* sync_writer); |
| // Returns the event handler installed on the AudioInputController. |
| EventHandler* event_handler() const { return event_handler_; } |
| - // Overriden to do nothing. It is assumed the caller will notify the event |
| - // handler with recorded data and other events. |
| - virtual void Record() OVERRIDE {} |
| + // Returns the AudioParameters passed by the requester upon creation through |
| + // AudioManager::Create(...). |
| + const AudioParameters& audio_parameters() const { return audio_parameters_; } |
| + |
| + // Notifies the TestAudioControllerOpened() event to the delegate (if any). |
| + virtual void Record() OVERRIDE; |
| // Ensure that the closure is run on the audio-manager thread. |
| virtual void Close(const base::Closure& closed_task) OVERRIDE; |
| @@ -63,6 +75,8 @@ class TestAudioInputController : public AudioInputController { |
| virtual ~TestAudioInputController(); |
| private: |
| + AudioParameters audio_parameters_; |
| + |
| // These are not owned by us and expected to be valid for this object's |
| // lifetime. |
| TestAudioInputControllerFactory* factory_; |
| @@ -71,11 +85,14 @@ class TestAudioInputController : public AudioInputController { |
| DISALLOW_COPY_AND_ASSIGN(TestAudioInputController); |
| }; |
| +typedef TestAudioInputController::Delegate TestAudioInputControllerDelegate; |
| + |
| // Simple AudioInputController::Factory method that creates |
| // TestAudioInputControllers. |
| class TestAudioInputControllerFactory : public AudioInputController::Factory { |
| public: |
| TestAudioInputControllerFactory(); |
| + virtual ~TestAudioInputControllerFactory(); |
| // AudioInputController::Factory methods. |
| virtual AudioInputController* Create( |
| @@ -83,6 +100,8 @@ class TestAudioInputControllerFactory : public AudioInputController::Factory { |
| AudioInputController::EventHandler* event_handler, |
| AudioParameters params) OVERRIDE; |
| + void SetDelegateForTests(TestAudioInputControllerDelegate* delegate); |
| + |
| TestAudioInputController* controller() const { return controller_; } |
| private: |
| @@ -95,6 +114,9 @@ class TestAudioInputControllerFactory : public AudioInputController::Factory { |
| // The caller of Create owns this object. |
| TestAudioInputController* controller_; |
| + // The delegate for tests for receiving audio controller events. |
| + TestAudioInputControllerDelegate* delegate_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(TestAudioInputControllerFactory); |
| }; |