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