| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_AUDIO_MOCK_AUDIO_MANAGER_H_ | 5 #ifndef MEDIA_AUDIO_MOCK_AUDIO_MANAGER_H_ |
| 6 #define MEDIA_AUDIO_MOCK_AUDIO_MANAGER_H_ | 6 #define MEDIA_AUDIO_MOCK_AUDIO_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "media/audio/audio_manager.h" | 9 #include "media/audio/audio_manager.h" |
| 10 | 10 |
| 11 namespace media { | 11 namespace media { |
| 12 | 12 |
| 13 // This class is a simple mock around AudioManager, used exclusively for tests, | 13 // This class is a simple mock around AudioManager, used exclusively for tests, |
| 14 // which avoids to use the actual (system and platform dependent) AudioManager. | 14 // which avoids to use the actual (system and platform dependent) AudioManager. |
| 15 // Some bots does not have input devices, thus using the actual AudioManager | 15 // Some bots does not have input devices, thus using the actual AudioManager |
| 16 // would causing failures on classes which expect that. | 16 // would causing failures on classes which expect that. |
| 17 class MockAudioManager : public media::AudioManager { | 17 class MockAudioManager : public media::AudioManager { |
| 18 public: | 18 public: |
| 19 explicit MockAudioManager( | 19 explicit MockAudioManager( |
| 20 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 20 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
| 21 | 21 |
| 22 bool HasAudioOutputDevices() override; | 22 bool HasAudioOutputDevices() override; |
| 23 | 23 |
| 24 bool HasAudioInputDevices() override; | 24 bool HasAudioInputDevices() override; |
| 25 | 25 |
| 26 base::string16 GetAudioInputDeviceModel() override; | 26 base::string16 GetAudioInputDeviceModel() override; |
| 27 | 27 |
| 28 void ShowAudioInputSettings() override; | 28 void ShowAudioInputSettings() override; |
| 29 | 29 |
| 30 void GetAudioInputDeviceNames(media::AudioDeviceNames* device_names) override; | 30 void GetAudioInputDeviceDescriptions( |
| 31 media::AudioDeviceDescriptions* device_descriptions) override; |
| 31 | 32 |
| 32 void GetAudioOutputDeviceNames( | 33 void GetAudioOutputDeviceDescriptions( |
| 33 media::AudioDeviceNames* device_names) override; | 34 media::AudioDeviceDescriptions* device_descriptions) override; |
| 34 | 35 |
| 35 media::AudioOutputStream* MakeAudioOutputStream( | 36 media::AudioOutputStream* MakeAudioOutputStream( |
| 36 const media::AudioParameters& params, | 37 const media::AudioParameters& params, |
| 37 const std::string& device_id, | 38 const std::string& device_id, |
| 38 const LogCallback& log_callback) override; | 39 const LogCallback& log_callback) override; |
| 39 | 40 |
| 40 media::AudioOutputStream* MakeAudioOutputStreamProxy( | 41 media::AudioOutputStream* MakeAudioOutputStreamProxy( |
| 41 const media::AudioParameters& params, | 42 const media::AudioParameters& params, |
| 42 const std::string& device_id) override; | 43 const std::string& device_id) override; |
| 43 | 44 |
| 44 media::AudioInputStream* MakeAudioInputStream( | 45 media::AudioInputStream* MakeAudioInputStream( |
| 45 const media::AudioParameters& params, | 46 const media::AudioParameters& params, |
| 46 const std::string& device_id, | 47 const std::string& device_id, |
| 47 const LogCallback& log_callback) override; | 48 const LogCallback& log_callback) override; |
| 48 | 49 |
| 49 void AddOutputDeviceChangeListener(AudioDeviceListener* listener) override; | 50 void AddOutputDeviceChangeListener(AudioDeviceListener* listener) override; |
| 50 void RemoveOutputDeviceChangeListener(AudioDeviceListener* listener) override; | 51 void RemoveOutputDeviceChangeListener(AudioDeviceListener* listener) override; |
| 51 | 52 |
| 52 AudioParameters GetDefaultOutputStreamParameters() override; | 53 AudioParameters GetDefaultOutputStreamParameters() override; |
| 53 AudioParameters GetOutputStreamParameters( | 54 AudioParameters GetOutputStreamParameters( |
| 54 const std::string& device_id) override; | 55 const std::string& device_id) override; |
| 55 AudioParameters GetInputStreamParameters( | 56 AudioParameters GetInputStreamParameters( |
| 56 const std::string& device_id) override; | 57 const std::string& device_id) override; |
| 57 std::string GetAssociatedOutputDeviceID( | 58 std::string GetAssociatedOutputDeviceID( |
| 58 const std::string& input_device_id) override; | 59 const std::string& input_device_id) override; |
| 59 std::string GetGroupIDOutput(const std::string& output_id) override; | |
| 60 std::string GetGroupIDInput(const std::string& input_id) override; | |
| 61 | 60 |
| 62 std::unique_ptr<AudioLog> CreateAudioLog( | 61 std::unique_ptr<AudioLog> CreateAudioLog( |
| 63 AudioLogFactory::AudioComponent component) override; | 62 AudioLogFactory::AudioComponent component) override; |
| 64 | 63 |
| 65 const char* GetName() override; | 64 const char* GetName() override; |
| 66 | 65 |
| 67 protected: | 66 protected: |
| 68 ~MockAudioManager() override; | 67 ~MockAudioManager() override; |
| 69 | 68 |
| 70 private: | 69 private: |
| 71 DISALLOW_COPY_AND_ASSIGN(MockAudioManager); | 70 DISALLOW_COPY_AND_ASSIGN(MockAudioManager); |
| 72 }; | 71 }; |
| 73 | 72 |
| 74 } // namespace media. | 73 } // namespace media. |
| 75 | 74 |
| 76 #endif // MEDIA_AUDIO_MOCK_AUDIO_MANAGER_H_ | 75 #endif // MEDIA_AUDIO_MOCK_AUDIO_MANAGER_H_ |
| OLD | NEW |