| 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 CONTENT_TEST_WEBRTC_AUDIO_DEVICE_TEST_H_ | 5 #ifndef CONTENT_TEST_WEBRTC_AUDIO_DEVICE_TEST_H_ |
| 6 #define CONTENT_TEST_WEBRTC_AUDIO_DEVICE_TEST_H_ | 6 #define CONTENT_TEST_WEBRTC_AUDIO_DEVICE_TEST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // Individual tests can provide an implementation (or mock) of this interface | 112 // Individual tests can provide an implementation (or mock) of this interface |
| 113 // when the audio code queries for hardware capabilities on the IO thread. | 113 // when the audio code queries for hardware capabilities on the IO thread. |
| 114 class AudioUtilInterface { | 114 class AudioUtilInterface { |
| 115 public: | 115 public: |
| 116 virtual ~AudioUtilInterface() {} | 116 virtual ~AudioUtilInterface() {} |
| 117 virtual int GetAudioHardwareSampleRate() = 0; | 117 virtual int GetAudioHardwareSampleRate() = 0; |
| 118 virtual int GetAudioInputHardwareSampleRate( | 118 virtual int GetAudioInputHardwareSampleRate( |
| 119 const std::string& device_id) = 0; | 119 const std::string& device_id) = 0; |
| 120 virtual media::ChannelLayout GetAudioInputHardwareChannelLayout( | 120 virtual media::ChannelLayout GetAudioInputHardwareChannelLayout( |
| 121 const std::string& device_id) = 0; | 121 const std::string& device_id) = 0; |
| 122 virtual int GetAudioOutputBufferSize() = 0; |
| 122 }; | 123 }; |
| 123 | 124 |
| 124 // Implemented and defined in the cc file. | 125 // Implemented and defined in the cc file. |
| 125 class ReplaceContentClientRenderer; | 126 class ReplaceContentClientRenderer; |
| 126 | 127 |
| 127 class WebRTCAudioDeviceTest : public ::testing::Test, public IPC::Listener { | 128 class WebRTCAudioDeviceTest : public ::testing::Test, public IPC::Listener { |
| 128 public: | 129 public: |
| 129 WebRTCAudioDeviceTest(); | 130 WebRTCAudioDeviceTest(); |
| 130 virtual ~WebRTCAudioDeviceTest(); | 131 virtual ~WebRTCAudioDeviceTest(); |
| 131 | 132 |
| 132 virtual void SetUp() OVERRIDE; | 133 virtual void SetUp() OVERRIDE; |
| 133 virtual void TearDown() OVERRIDE; | 134 virtual void TearDown() OVERRIDE; |
| 134 | 135 |
| 135 // Sends an IPC message to the IO thread channel. | 136 // Sends an IPC message to the IO thread channel. |
| 136 bool Send(IPC::Message* message); | 137 bool Send(IPC::Message* message); |
| 137 | 138 |
| 138 void SetAudioUtilCallback(AudioUtilInterface* callback); | 139 void SetAudioUtilCallback(AudioUtilInterface* callback); |
| 139 | 140 |
| 140 protected: | 141 protected: |
| 141 void InitializeIOThread(const char* thread_name); | 142 void InitializeIOThread(const char* thread_name); |
| 142 void UninitializeIOThread(); | 143 void UninitializeIOThread(); |
| 143 void CreateChannel(const char* name); | 144 void CreateChannel(const char* name); |
| 144 void DestroyChannel(); | 145 void DestroyChannel(); |
| 145 | 146 |
| 146 void OnGetHardwareSampleRate(int* sample_rate); | 147 void OnGetHardwareSampleRate(int* sample_rate); |
| 147 void OnGetHardwareInputSampleRate(int* sample_rate); | 148 void OnGetHardwareInputSampleRate(int* sample_rate); |
| 148 void OnGetHardwareInputChannelLayout(media::ChannelLayout* channels); | 149 void OnGetHardwareInputChannelLayout(media::ChannelLayout* channels); |
| 150 void OnGetHardwareBufferSize(uint32* buffer_size); |
| 149 | 151 |
| 150 // IPC::Listener implementation. | 152 // IPC::Listener implementation. |
| 151 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 153 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 152 | 154 |
| 153 // Posts a final task to the IO message loop and waits for completion. | 155 // Posts a final task to the IO message loop and waits for completion. |
| 154 void WaitForIOThreadCompletion(); | 156 void WaitForIOThreadCompletion(); |
| 155 void WaitForAudioManagerCompletion(); | 157 void WaitForAudioManagerCompletion(); |
| 156 void WaitForMessageLoopCompletion(base::MessageLoopProxy* loop); | 158 void WaitForMessageLoopCompletion(base::MessageLoopProxy* loop); |
| 157 | 159 |
| 158 // Convenience getter for gmock. | 160 // Convenience getter for gmock. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 virtual int SendPacket(int channel, const void* data, int len) OVERRIDE; | 211 virtual int SendPacket(int channel, const void* data, int len) OVERRIDE; |
| 210 virtual int SendRTCPPacket(int channel, const void* data, int len) OVERRIDE; | 212 virtual int SendRTCPPacket(int channel, const void* data, int len) OVERRIDE; |
| 211 | 213 |
| 212 private: | 214 private: |
| 213 webrtc::VoENetwork* network_; | 215 webrtc::VoENetwork* network_; |
| 214 }; | 216 }; |
| 215 | 217 |
| 216 } // namespace content | 218 } // namespace content |
| 217 | 219 |
| 218 #endif // CONTENT_TEST_WEBRTC_AUDIO_DEVICE_TEST_H_ | 220 #endif // CONTENT_TEST_WEBRTC_AUDIO_DEVICE_TEST_H_ |
| OLD | NEW |