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

Unified Diff: media/audio/mock_audio_manager.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: Changed MockAudioManager ctor 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
« no previous file with comments | « content/browser/speech/speech_recognizer_unittest.cc ('k') | media/audio/mock_audio_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/mock_audio_manager.h
diff --git a/media/audio/mock_audio_manager.h b/media/audio/mock_audio_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..a2e01f7b1e93c45f61fed4094cf0c9c529009678
--- /dev/null
+++ b/media/audio/mock_audio_manager.h
@@ -0,0 +1,70 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_AUDIO_MOCK_AUDIO_MANAGER_H_
+#define MEDIA_AUDIO_MOCK_AUDIO_MANAGER_H_
+#pragma once
+
+#include "media/audio/audio_manager.h"
+
+namespace media {
+// This class is a simple mock around AudioManager, used exclusively for tests,
Satish 2012/07/12 09:38:13 a newline above to make it easier for reading
Primiano Tucci (use gerrit) 2012/07/12 09:42:03 Done.
+// which has the following purposes:
+// 1) Avoids to use the actual (system and platform dependent) AudioManager.
+// Some bots does not have input devices, thus using the actual AudioManager
+// would causing failures on classes which expect that.
+// 2) Allows the mock audio events to be dispatched on an arbitrary thread,
+// rather than forcing them on the audio thread, easing their handling in
+// browser tests (Note: sharing a thread can cause deadlocks on production
+// classes if WaitableEvents or any other form of lock is used for
+// synchronization purposes).
+class MockAudioManager : public media::AudioManager {
+ public:
+ explicit MockAudioManager(
+ scoped_refptr<base::MessageLoopProxy> message_loop_proxy);
tommi (sloooow) - chröme 2012/07/12 08:32:05 should be: explicit MockAudioManager(base::Message
Primiano Tucci (use gerrit) 2012/07/12 09:42:03 Done.
+
+ virtual bool HasAudioOutputDevices() OVERRIDE;
+
+ virtual bool HasAudioInputDevices() OVERRIDE;
+
+ virtual string16 GetAudioInputDeviceModel() OVERRIDE;
+
+ virtual bool CanShowAudioInputSettings() OVERRIDE;
+
+ virtual void ShowAudioInputSettings() OVERRIDE;
+
+ virtual void GetAudioInputDeviceNames(
+ media::AudioDeviceNames* device_names) OVERRIDE;
+
+ virtual media::AudioOutputStream* MakeAudioOutputStream(
+ const media::AudioParameters& params) OVERRIDE;
+
+ virtual media::AudioOutputStream* MakeAudioOutputStreamProxy(
+ const media::AudioParameters& params) OVERRIDE;
+
+ virtual media::AudioInputStream* MakeAudioInputStream(
+ const media::AudioParameters& params,
+ const std::string& device_id) OVERRIDE;
+
+ virtual void MuteAll() OVERRIDE;
+
+ virtual void UnMuteAll() OVERRIDE;
+
+ virtual bool IsRecordingInProcess() OVERRIDE;
+
+ virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() OVERRIDE;
+
+ virtual void Init() OVERRIDE;
+
+ private:
+ virtual ~MockAudioManager();
+
+ scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
+
+ DISALLOW_COPY_AND_ASSIGN(MockAudioManager);
+};
+
+} // namespace media.
+
+#endif // MEDIA_AUDIO_MOCK_AUDIO_MANAGER_H_
« no previous file with comments | « content/browser/speech/speech_recognizer_unittest.cc ('k') | media/audio/mock_audio_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698