| 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/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/sequenced_task_runner_helpers.h" | 10 #include "base/sequenced_task_runner_helpers.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 using UniquePtr = std::unique_ptr<MockAudioManager, Deleter>; | 26 using UniquePtr = std::unique_ptr<MockAudioManager, Deleter>; |
| 27 using GetDeviceDescriptionsCallback = | 27 using GetDeviceDescriptionsCallback = |
| 28 base::RepeatingCallback<void(AudioDeviceDescriptions*)>; | 28 base::RepeatingCallback<void(AudioDeviceDescriptions*)>; |
| 29 using GetAssociatedOutputDeviceIDCallback = | 29 using GetAssociatedOutputDeviceIDCallback = |
| 30 base::RepeatingCallback<std::string(const std::string&)>; | 30 base::RepeatingCallback<std::string(const std::string&)>; |
| 31 | 31 |
| 32 explicit MockAudioManager( | 32 explicit MockAudioManager( |
| 33 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 33 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
| 34 | 34 |
| 35 bool HasAudioOutputDevices() override; | |
| 36 | |
| 37 bool HasAudioInputDevices() override; | |
| 38 | |
| 39 base::string16 GetAudioInputDeviceModel() override; | |
| 40 | |
| 41 void ShowAudioInputSettings() override; | |
| 42 | |
| 43 void GetAudioInputDeviceDescriptions( | |
| 44 media::AudioDeviceDescriptions* device_descriptions) override; | |
| 45 | |
| 46 void GetAudioOutputDeviceDescriptions( | |
| 47 media::AudioDeviceDescriptions* device_descriptions) override; | |
| 48 | |
| 49 AudioOutputStream* MakeAudioOutputStream( | 35 AudioOutputStream* MakeAudioOutputStream( |
| 50 const media::AudioParameters& params, | 36 const media::AudioParameters& params, |
| 51 const std::string& device_id, | 37 const std::string& device_id, |
| 52 const LogCallback& log_callback) override; | 38 const LogCallback& log_callback) override; |
| 53 | 39 |
| 54 AudioOutputStream* MakeAudioOutputStreamProxy( | 40 AudioOutputStream* MakeAudioOutputStreamProxy( |
| 55 const media::AudioParameters& params, | 41 const media::AudioParameters& params, |
| 56 const std::string& device_id) override; | 42 const std::string& device_id) override; |
| 57 | 43 |
| 58 AudioInputStream* MakeAudioInputStream( | 44 AudioInputStream* MakeAudioInputStream( |
| 59 const media::AudioParameters& params, | 45 const media::AudioParameters& params, |
| 60 const std::string& device_id, | 46 const std::string& device_id, |
| 61 const LogCallback& log_callback) override; | 47 const LogCallback& log_callback) override; |
| 62 | 48 |
| 63 void AddOutputDeviceChangeListener(AudioDeviceListener* listener) override; | 49 void AddOutputDeviceChangeListener(AudioDeviceListener* listener) override; |
| 64 void RemoveOutputDeviceChangeListener(AudioDeviceListener* listener) override; | 50 void RemoveOutputDeviceChangeListener(AudioDeviceListener* listener) override; |
| 65 | 51 |
| 66 AudioParameters GetDefaultOutputStreamParameters() override; | |
| 67 AudioParameters GetOutputStreamParameters( | |
| 68 const std::string& device_id) override; | |
| 69 AudioParameters GetInputStreamParameters( | |
| 70 const std::string& device_id) override; | |
| 71 std::string GetAssociatedOutputDeviceID( | |
| 72 const std::string& input_device_id) override; | |
| 73 | |
| 74 std::unique_ptr<AudioLog> CreateAudioLog( | 52 std::unique_ptr<AudioLog> CreateAudioLog( |
| 75 AudioLogFactory::AudioComponent component) override; | 53 AudioLogFactory::AudioComponent component) override; |
| 76 | 54 |
| 77 void InitializeOutputDebugRecording( | 55 void InitializeOutputDebugRecording( |
| 78 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner) override; | 56 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner) override; |
| 79 void EnableOutputDebugRecording( | 57 void EnableOutputDebugRecording( |
| 80 const base::FilePath& base_file_name) override; | 58 const base::FilePath& base_file_name) override; |
| 81 void DisableOutputDebugRecording() override; | 59 void DisableOutputDebugRecording() override; |
| 82 | 60 |
| 83 const char* GetName() override; | 61 const char* GetName() override; |
| 84 | 62 |
| 85 // Setters to emulate desired in-test behavior. | 63 // Setters to emulate desired in-test behavior. |
| 86 void SetInputStreamParameters(const AudioParameters& params); | 64 void SetInputStreamParameters(const AudioParameters& params); |
| 87 void SetOutputStreamParameters(const AudioParameters& params); | 65 void SetOutputStreamParameters(const AudioParameters& params); |
| 88 void SetDefaultOutputStreamParameters(const AudioParameters& params); | 66 void SetDefaultOutputStreamParameters(const AudioParameters& params); |
| 89 void SetHasInputDevices(bool has_input_devices); | 67 void SetHasInputDevices(bool has_input_devices); |
| 90 void SetHasOutputDevices(bool has_output_devices); | 68 void SetHasOutputDevices(bool has_output_devices); |
| 91 void SetInputDeviceDescriptionsCallback( | 69 void SetInputDeviceDescriptionsCallback( |
| 92 GetDeviceDescriptionsCallback callback); | 70 GetDeviceDescriptionsCallback callback); |
| 93 void SetOutputDeviceDescriptionsCallback( | 71 void SetOutputDeviceDescriptionsCallback( |
| 94 GetDeviceDescriptionsCallback callback); | 72 GetDeviceDescriptionsCallback callback); |
| 95 void SetAssociatedOutputDeviceIDCallback( | 73 void SetAssociatedOutputDeviceIDCallback( |
| 96 GetAssociatedOutputDeviceIDCallback callback); | 74 GetAssociatedOutputDeviceIDCallback callback); |
| 97 | 75 |
| 98 protected: | 76 protected: |
| 99 ~MockAudioManager() override; | 77 ~MockAudioManager() override; |
| 100 | 78 |
| 79 bool HasAudioOutputDevices() override; |
| 80 |
| 81 bool HasAudioInputDevices() override; |
| 82 |
| 83 base::string16 GetAudioInputDeviceModel() override; |
| 84 |
| 85 void ShowAudioInputSettings() override; |
| 86 |
| 87 void GetAudioInputDeviceDescriptions( |
| 88 media::AudioDeviceDescriptions* device_descriptions) override; |
| 89 |
| 90 void GetAudioOutputDeviceDescriptions( |
| 91 media::AudioDeviceDescriptions* device_descriptions) override; |
| 92 |
| 93 AudioParameters GetDefaultOutputStreamParameters() override; |
| 94 AudioParameters GetOutputStreamParameters( |
| 95 const std::string& device_id) override; |
| 96 AudioParameters GetInputStreamParameters( |
| 97 const std::string& device_id) override; |
| 98 std::string GetAssociatedOutputDeviceID( |
| 99 const std::string& input_device_id) override; |
| 100 |
| 101 private: | 101 private: |
| 102 friend class base::DeleteHelper<MockAudioManager>; | 102 friend class base::DeleteHelper<MockAudioManager>; |
| 103 | 103 |
| 104 AudioParameters input_params_; | 104 AudioParameters input_params_; |
| 105 AudioParameters output_params_; | 105 AudioParameters output_params_; |
| 106 AudioParameters default_output_params_; | 106 AudioParameters default_output_params_; |
| 107 bool has_input_devices_ = true; | 107 bool has_input_devices_ = true; |
| 108 bool has_output_devices_ = true; | 108 bool has_output_devices_ = true; |
| 109 GetDeviceDescriptionsCallback get_input_device_descriptions_cb_; | 109 GetDeviceDescriptionsCallback get_input_device_descriptions_cb_; |
| 110 GetDeviceDescriptionsCallback get_output_device_descriptions_cb_; | 110 GetDeviceDescriptionsCallback get_output_device_descriptions_cb_; |
| 111 GetAssociatedOutputDeviceIDCallback get_associated_output_device_id_cb_; | 111 GetAssociatedOutputDeviceIDCallback get_associated_output_device_id_cb_; |
| 112 | 112 |
| 113 DISALLOW_COPY_AND_ASSIGN(MockAudioManager); | 113 DISALLOW_COPY_AND_ASSIGN(MockAudioManager); |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 } // namespace media. | 116 } // namespace media. |
| 117 | 117 |
| 118 #endif // MEDIA_AUDIO_MOCK_AUDIO_MANAGER_H_ | 118 #endif // MEDIA_AUDIO_MOCK_AUDIO_MANAGER_H_ |
| OLD | NEW |