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

Unified Diff: media/audio/test_audio_input_controller_factory.h

Issue 10704154: Small refactor to media architecture in order to allow end-to-end tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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: 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 b4a2cb16b647dd642d2977771bcfb399b84b8fe1..3e86735e609ce4e1e2e158cdaad0f3ba8e6198e3 100644
--- a/media/audio/test_audio_input_controller_factory.h
+++ b/media/audio/test_audio_input_controller_factory.h
@@ -45,17 +45,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,
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;
@@ -64,6 +76,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_;
@@ -72,11 +86,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(
@@ -84,6 +101,8 @@ class TestAudioInputControllerFactory : public AudioInputController::Factory {
AudioInputController::EventHandler* event_handler,
AudioParameters params) OVERRIDE;
+ void SetDelegateForTests(TestAudioInputControllerDelegate* delegate);
+
TestAudioInputController* controller() const { return controller_; }
private:
@@ -96,6 +115,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);
};

Powered by Google App Engine
This is Rietveld 408576698