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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 T* ptr_; | 102 T* ptr_; |
103 }; | 103 }; |
104 | 104 |
105 // Individual tests can provide an implementation (or mock) of this interface | 105 // Individual tests can provide an implementation (or mock) of this interface |
106 // when the audio code queries for hardware capabilities on the IO thread. | 106 // when the audio code queries for hardware capabilities on the IO thread. |
107 class AudioUtilInterface { | 107 class AudioUtilInterface { |
108 public: | 108 public: |
109 virtual ~AudioUtilInterface() {} | 109 virtual ~AudioUtilInterface() {} |
110 virtual double GetAudioHardwareSampleRate() = 0; | 110 virtual double GetAudioHardwareSampleRate() = 0; |
111 virtual double GetAudioInputHardwareSampleRate() = 0; | 111 virtual double GetAudioInputHardwareSampleRate() = 0; |
| 112 virtual uint32 GetAudioInputHardwareChannelCount() = 0; |
112 }; | 113 }; |
113 | 114 |
114 // Implemented and defined in the cc file. | 115 // Implemented and defined in the cc file. |
115 class ReplaceContentClientRenderer; | 116 class ReplaceContentClientRenderer; |
116 | 117 |
117 class WebRTCAudioDeviceTest | 118 class WebRTCAudioDeviceTest |
118 : public ::testing::Test, | 119 : public ::testing::Test, |
119 public IPC::Channel::Listener { | 120 public IPC::Channel::Listener { |
120 public: | 121 public: |
121 WebRTCAudioDeviceTest(); | 122 WebRTCAudioDeviceTest(); |
122 virtual ~WebRTCAudioDeviceTest(); | 123 virtual ~WebRTCAudioDeviceTest(); |
123 | 124 |
124 virtual void SetUp() OVERRIDE; | 125 virtual void SetUp() OVERRIDE; |
125 virtual void TearDown() OVERRIDE; | 126 virtual void TearDown() OVERRIDE; |
126 | 127 |
127 // Sends an IPC message to the IO thread channel. | 128 // Sends an IPC message to the IO thread channel. |
128 bool Send(IPC::Message* message); | 129 bool Send(IPC::Message* message); |
129 | 130 |
130 void SetAudioUtilCallback(AudioUtilInterface* callback); | 131 void SetAudioUtilCallback(AudioUtilInterface* callback); |
131 | 132 |
132 protected: | 133 protected: |
133 void InitializeIOThread(const char* thread_name); | 134 void InitializeIOThread(const char* thread_name); |
134 void UninitializeIOThread(); | 135 void UninitializeIOThread(); |
135 void CreateChannel(const char* name); | 136 void CreateChannel(const char* name); |
136 void DestroyChannel(); | 137 void DestroyChannel(); |
137 | 138 |
138 void OnGetHardwareSampleRate(double* sample_rate); | 139 void OnGetHardwareSampleRate(double* sample_rate); |
139 void OnGetHardwareInputSampleRate(double* sample_rate); | 140 void OnGetHardwareInputSampleRate(double* sample_rate); |
| 141 void OnGetHardwareInputChannelCount(uint32* channels); |
140 | 142 |
141 // IPC::Channel::Listener implementation. | 143 // IPC::Channel::Listener implementation. |
142 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 144 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
143 | 145 |
144 // Posts a final task to the IO message loop and waits for completion. | 146 // Posts a final task to the IO message loop and waits for completion. |
145 void WaitForIOThreadCompletion(); | 147 void WaitForIOThreadCompletion(); |
146 void WaitForAudioManagerCompletion(); | 148 void WaitForAudioManagerCompletion(); |
147 void WaitForMessageLoopCompletion(base::MessageLoopProxy* loop); | 149 void WaitForMessageLoopCompletion(base::MessageLoopProxy* loop); |
148 | 150 |
149 // Convenience getter for gmock. | 151 // Convenience getter for gmock. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 virtual ~WebRTCTransportImpl(); | 188 virtual ~WebRTCTransportImpl(); |
187 | 189 |
188 virtual int SendPacket(int channel, const void* data, int len) OVERRIDE; | 190 virtual int SendPacket(int channel, const void* data, int len) OVERRIDE; |
189 virtual int SendRTCPPacket(int channel, const void* data, int len) OVERRIDE; | 191 virtual int SendRTCPPacket(int channel, const void* data, int len) OVERRIDE; |
190 | 192 |
191 private: | 193 private: |
192 webrtc::VoENetwork* network_; | 194 webrtc::VoENetwork* network_; |
193 }; | 195 }; |
194 | 196 |
195 #endif // CONTENT_TEST_WEBRTC_AUDIO_DEVICE_TEST_H_ | 197 #endif // CONTENT_TEST_WEBRTC_AUDIO_DEVICE_TEST_H_ |
OLD | NEW |