OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/environment.h" | 6 #include "base/environment.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "media/audio/audio_manager.h" | 10 #include "media/audio/audio_manager.h" |
11 #include "media/audio/audio_manager_base.h" | 11 #include "media/audio/audio_manager_base.h" |
| 12 #include "media/audio/audio_unittest_util.h" |
12 #include "media/audio/fake_audio_log_factory.h" | 13 #include "media/audio/fake_audio_log_factory.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
14 | 15 |
15 #if defined(USE_ALSA) | 16 #if defined(USE_ALSA) |
16 #include "media/audio/alsa/audio_manager_alsa.h" | 17 #include "media/audio/alsa/audio_manager_alsa.h" |
17 #endif // defined(USE_ALSA) | 18 #endif // defined(USE_ALSA) |
18 | 19 |
19 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
20 #include "base/win/scoped_com_initializer.h" | 21 #include "base/win/scoped_com_initializer.h" |
21 #include "media/audio/win/audio_manager_win.h" | 22 #include "media/audio/win/audio_manager_win.h" |
(...skipping 17 matching lines...) Expand all Loading... |
39 #endif | 40 #endif |
40 { | 41 { |
41 // Wait for audio thread initialization to complete. Otherwise the | 42 // Wait for audio thread initialization to complete. Otherwise the |
42 // enumeration type may not have been set yet. | 43 // enumeration type may not have been set yet. |
43 base::WaitableEvent event(false, false); | 44 base::WaitableEvent event(false, false); |
44 audio_manager_->GetTaskRunner()->PostTask(FROM_HERE, base::Bind( | 45 audio_manager_->GetTaskRunner()->PostTask(FROM_HERE, base::Bind( |
45 &base::WaitableEvent::Signal, base::Unretained(&event))); | 46 &base::WaitableEvent::Signal, base::Unretained(&event))); |
46 event.Wait(); | 47 event.Wait(); |
47 } | 48 } |
48 | 49 |
49 AudioManager* audio_manager() { return audio_manager_.get(); }; | |
50 | |
51 #if defined(OS_WIN) | 50 #if defined(OS_WIN) |
52 bool SetMMDeviceEnumeration() { | 51 bool SetMMDeviceEnumeration() { |
53 AudioManagerWin* amw = static_cast<AudioManagerWin*>(audio_manager_.get()); | 52 AudioManagerWin* amw = static_cast<AudioManagerWin*>(audio_manager_.get()); |
54 // Windows Wave is used as default if Windows XP was detected => | 53 // Windows Wave is used as default if Windows XP was detected => |
55 // return false since MMDevice is not supported on XP. | 54 // return false since MMDevice is not supported on XP. |
56 if (amw->enumeration_type() == AudioManagerWin::kWaveEnumeration) | 55 if (amw->enumeration_type() == AudioManagerWin::kWaveEnumeration) |
57 return false; | 56 return false; |
58 | 57 |
59 amw->SetEnumerationType(AudioManagerWin::kMMDeviceEnumeration); | 58 amw->SetEnumerationType(AudioManagerWin::kMMDeviceEnumeration); |
60 return true; | 59 return true; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 ++it; | 105 ++it; |
107 } | 106 } |
108 } else { | 107 } else { |
109 // Log a warning so we can see the status on the build bots. No need to | 108 // Log a warning so we can see the status on the build bots. No need to |
110 // break the test though since this does successfully test the code and | 109 // break the test though since this does successfully test the code and |
111 // some failure cases. | 110 // some failure cases. |
112 LOG(WARNING) << "No input devices detected"; | 111 LOG(WARNING) << "No input devices detected"; |
113 } | 112 } |
114 } | 113 } |
115 | 114 |
116 bool CanRunInputTest() { | 115 bool InputDevicesAvailable() { |
117 return audio_manager_->HasAudioInputDevices(); | 116 return audio_manager_->HasAudioInputDevices(); |
118 } | 117 } |
119 | 118 |
120 bool CanRunOutputTest() { | 119 bool OutputDevicesAvailable() { |
121 return audio_manager_->HasAudioOutputDevices(); | 120 return audio_manager_->HasAudioOutputDevices(); |
122 } | 121 } |
123 | 122 |
124 #if defined(USE_ALSA) || defined(USE_PULSEAUDIO) | 123 #if defined(USE_ALSA) || defined(USE_PULSEAUDIO) |
125 template <class T> | 124 template <class T> |
126 void CreateAudioManagerForTesting() { | 125 void CreateAudioManagerForTesting() { |
127 // Only one AudioManager may exist at a time, so destroy the one we're | 126 // Only one AudioManager may exist at a time, so destroy the one we're |
128 // currently holding before creating a new one. | 127 // currently holding before creating a new one. |
129 audio_manager_.reset(); | 128 audio_manager_.reset(); |
130 audio_manager_.reset(T::Create(&fake_audio_log_factory_)); | 129 audio_manager_.reset(T::Create(&fake_audio_log_factory_)); |
131 } | 130 } |
132 #endif | 131 #endif |
133 | 132 |
134 // Synchronously runs the provided callback/closure on the audio thread. | 133 // Synchronously runs the provided callback/closure on the audio thread. |
135 void RunOnAudioThread(const base::Closure& closure) { | 134 void RunOnAudioThread(const base::Closure& closure) { |
136 if (!audio_manager()->GetTaskRunner()->BelongsToCurrentThread()) { | 135 if (!audio_manager_->GetTaskRunner()->BelongsToCurrentThread()) { |
137 base::WaitableEvent event(false, false); | 136 base::WaitableEvent event(false, false); |
138 audio_manager_->GetTaskRunner()->PostTask( | 137 audio_manager_->GetTaskRunner()->PostTask( |
139 FROM_HERE, | 138 FROM_HERE, |
140 base::Bind(&AudioManagerTest::RunOnAudioThreadImpl, | 139 base::Bind(&AudioManagerTest::RunOnAudioThreadImpl, |
141 base::Unretained(this), | 140 base::Unretained(this), |
142 closure, | 141 closure, |
143 &event)); | 142 &event)); |
144 event.Wait(); | 143 event.Wait(); |
145 } else { | 144 } else { |
146 closure.Run(); | 145 closure.Run(); |
147 } | 146 } |
148 } | 147 } |
149 | 148 |
150 void RunOnAudioThreadImpl(const base::Closure& closure, | 149 void RunOnAudioThreadImpl(const base::Closure& closure, |
151 base::WaitableEvent* event) { | 150 base::WaitableEvent* event) { |
152 DCHECK(audio_manager()->GetTaskRunner()->BelongsToCurrentThread()); | 151 DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); |
153 closure.Run(); | 152 closure.Run(); |
154 event->Signal(); | 153 event->Signal(); |
155 } | 154 } |
156 | 155 |
157 FakeAudioLogFactory fake_audio_log_factory_; | 156 FakeAudioLogFactory fake_audio_log_factory_; |
158 scoped_ptr<AudioManager> audio_manager_; | 157 scoped_ptr<AudioManager> audio_manager_; |
159 | 158 |
160 #if defined(OS_WIN) | 159 #if defined(OS_WIN) |
161 // The MMDevice API requires COM to be initialized on the current thread. | 160 // The MMDevice API requires COM to be initialized on the current thread. |
162 base::win::ScopedCOMInitializer com_init_; | 161 base::win::ScopedCOMInitializer com_init_; |
163 #endif | 162 #endif |
164 }; | 163 }; |
165 | 164 |
166 // Test that devices can be enumerated. | 165 // Test that devices can be enumerated. |
167 TEST_F(AudioManagerTest, EnumerateInputDevices) { | 166 TEST_F(AudioManagerTest, EnumerateInputDevices) { |
168 if (!CanRunInputTest()) | 167 ABORT_AUDIO_TEST_IF_NOT(InputDevicesAvailable()); |
169 return; | |
170 | 168 |
171 AudioDeviceNames device_names; | 169 AudioDeviceNames device_names; |
172 RunOnAudioThread( | 170 RunOnAudioThread( |
173 base::Bind(&AudioManager::GetAudioInputDeviceNames, | 171 base::Bind(&AudioManager::GetAudioInputDeviceNames, |
174 base::Unretained(audio_manager()), | 172 base::Unretained(audio_manager_.get()), |
175 &device_names)); | 173 &device_names)); |
176 CheckDeviceNames(device_names); | 174 CheckDeviceNames(device_names); |
177 } | 175 } |
178 | 176 |
179 // Test that devices can be enumerated. | 177 // Test that devices can be enumerated. |
180 TEST_F(AudioManagerTest, EnumerateOutputDevices) { | 178 TEST_F(AudioManagerTest, EnumerateOutputDevices) { |
181 if (!CanRunOutputTest()) | 179 ABORT_AUDIO_TEST_IF_NOT(OutputDevicesAvailable()); |
182 return; | |
183 | 180 |
184 AudioDeviceNames device_names; | 181 AudioDeviceNames device_names; |
185 RunOnAudioThread( | 182 RunOnAudioThread( |
186 base::Bind(&AudioManager::GetAudioOutputDeviceNames, | 183 base::Bind(&AudioManager::GetAudioOutputDeviceNames, |
187 base::Unretained(audio_manager()), | 184 base::Unretained(audio_manager_.get()), |
188 &device_names)); | 185 &device_names)); |
189 CheckDeviceNames(device_names); | 186 CheckDeviceNames(device_names); |
190 } | 187 } |
191 | 188 |
192 // Run additional tests for Windows since enumeration can be done using | 189 // Run additional tests for Windows since enumeration can be done using |
193 // two different APIs. MMDevice is default for Vista and higher and Wave | 190 // two different APIs. MMDevice is default for Vista and higher and Wave |
194 // is default for XP and lower. | 191 // is default for XP and lower. |
195 #if defined(OS_WIN) | 192 #if defined(OS_WIN) |
196 | 193 |
197 // Override default enumeration API and force usage of Windows MMDevice. | 194 // Override default enumeration API and force usage of Windows MMDevice. |
198 // This test will only run on Windows Vista and higher. | 195 // This test will only run on Windows Vista and higher. |
199 TEST_F(AudioManagerTest, EnumerateInputDevicesWinMMDevice) { | 196 TEST_F(AudioManagerTest, EnumerateInputDevicesWinMMDevice) { |
200 if (!CanRunInputTest()) | 197 ABORT_AUDIO_TEST_IF_NOT(InputDevicesAvailable()); |
201 return; | |
202 | 198 |
203 AudioDeviceNames device_names; | 199 AudioDeviceNames device_names; |
204 if (!SetMMDeviceEnumeration()) { | 200 if (!SetMMDeviceEnumeration()) { |
205 // Usage of MMDevice will fail on XP and lower. | 201 // Usage of MMDevice will fail on XP and lower. |
206 LOG(WARNING) << "MM device enumeration is not supported."; | 202 LOG(WARNING) << "MM device enumeration is not supported."; |
207 return; | 203 return; |
208 } | 204 } |
209 audio_manager_->GetAudioInputDeviceNames(&device_names); | 205 audio_manager_->GetAudioInputDeviceNames(&device_names); |
210 CheckDeviceNames(device_names); | 206 CheckDeviceNames(device_names); |
211 } | 207 } |
212 | 208 |
213 TEST_F(AudioManagerTest, EnumerateOutputDevicesWinMMDevice) { | 209 TEST_F(AudioManagerTest, EnumerateOutputDevicesWinMMDevice) { |
214 if (!CanRunOutputTest()) | 210 ABORT_AUDIO_TEST_IF_NOT(OutputDevicesAvailable()); |
215 return; | |
216 | 211 |
217 AudioDeviceNames device_names; | 212 AudioDeviceNames device_names; |
218 if (!SetMMDeviceEnumeration()) { | 213 if (!SetMMDeviceEnumeration()) { |
219 // Usage of MMDevice will fail on XP and lower. | 214 // Usage of MMDevice will fail on XP and lower. |
220 LOG(WARNING) << "MM device enumeration is not supported."; | 215 LOG(WARNING) << "MM device enumeration is not supported."; |
221 return; | 216 return; |
222 } | 217 } |
223 audio_manager_->GetAudioOutputDeviceNames(&device_names); | 218 audio_manager_->GetAudioOutputDeviceNames(&device_names); |
224 CheckDeviceNames(device_names); | 219 CheckDeviceNames(device_names); |
225 } | 220 } |
226 | 221 |
227 // Override default enumeration API and force usage of Windows Wave. | 222 // Override default enumeration API and force usage of Windows Wave. |
228 // This test will run on Windows XP, Windows Vista and Windows 7. | 223 // This test will run on Windows XP, Windows Vista and Windows 7. |
229 TEST_F(AudioManagerTest, EnumerateInputDevicesWinWave) { | 224 TEST_F(AudioManagerTest, EnumerateInputDevicesWinWave) { |
230 if (!CanRunInputTest()) | 225 ABORT_AUDIO_TEST_IF_NOT(InputDevicesAvailable()); |
231 return; | |
232 | 226 |
233 AudioDeviceNames device_names; | 227 AudioDeviceNames device_names; |
234 SetWaveEnumeration(); | 228 SetWaveEnumeration(); |
235 audio_manager_->GetAudioInputDeviceNames(&device_names); | 229 audio_manager_->GetAudioInputDeviceNames(&device_names); |
236 CheckDeviceNames(device_names); | 230 CheckDeviceNames(device_names); |
237 } | 231 } |
238 | 232 |
239 TEST_F(AudioManagerTest, EnumerateOutputDevicesWinWave) { | 233 TEST_F(AudioManagerTest, EnumerateOutputDevicesWinWave) { |
240 if (!CanRunOutputTest()) | 234 ABORT_AUDIO_TEST_IF_NOT(OutputDevicesAvailable()); |
241 return; | |
242 | 235 |
243 AudioDeviceNames device_names; | 236 AudioDeviceNames device_names; |
244 SetWaveEnumeration(); | 237 SetWaveEnumeration(); |
245 audio_manager_->GetAudioOutputDeviceNames(&device_names); | 238 audio_manager_->GetAudioOutputDeviceNames(&device_names); |
246 CheckDeviceNames(device_names); | 239 CheckDeviceNames(device_names); |
247 } | 240 } |
248 | 241 |
249 TEST_F(AudioManagerTest, WinXPDeviceIdUnchanged) { | 242 TEST_F(AudioManagerTest, WinXPDeviceIdUnchanged) { |
250 if (!CanRunInputTest()) | 243 ABORT_AUDIO_TEST_IF_NOT(InputDevicesAvailable()); |
251 return; | |
252 | 244 |
253 AudioDeviceNames xp_device_names; | 245 AudioDeviceNames xp_device_names; |
254 SetWaveEnumeration(); | 246 SetWaveEnumeration(); |
255 audio_manager_->GetAudioInputDeviceNames(&xp_device_names); | 247 audio_manager_->GetAudioInputDeviceNames(&xp_device_names); |
256 CheckDeviceNames(xp_device_names); | 248 CheckDeviceNames(xp_device_names); |
257 | 249 |
258 // Device ID should remain unchanged, including the default device ID. | 250 // Device ID should remain unchanged, including the default device ID. |
259 for (AudioDeviceNames::iterator i = xp_device_names.begin(); | 251 for (AudioDeviceNames::iterator i = xp_device_names.begin(); |
260 i != xp_device_names.end(); ++i) { | 252 i != xp_device_names.end(); ++i) { |
261 EXPECT_EQ(i->unique_id, | 253 EXPECT_EQ(i->unique_id, |
262 GetDeviceIdFromPCMWaveInAudioInputStream(i->unique_id)); | 254 GetDeviceIdFromPCMWaveInAudioInputStream(i->unique_id)); |
263 } | 255 } |
264 } | 256 } |
265 | 257 |
266 TEST_F(AudioManagerTest, ConvertToWinXPInputDeviceId) { | 258 TEST_F(AudioManagerTest, ConvertToWinXPInputDeviceId) { |
267 if (!CanRunInputTest()) | 259 ABORT_AUDIO_TEST_IF_NOT(InputDevicesAvailable()); |
268 return; | |
269 | 260 |
270 if (!SetMMDeviceEnumeration()) { | 261 if (!SetMMDeviceEnumeration()) { |
271 // Usage of MMDevice will fail on XP and lower. | 262 // Usage of MMDevice will fail on XP and lower. |
272 LOG(WARNING) << "MM device enumeration is not supported."; | 263 LOG(WARNING) << "MM device enumeration is not supported."; |
273 return; | 264 return; |
274 } | 265 } |
275 | 266 |
276 AudioDeviceNames device_names; | 267 AudioDeviceNames device_names; |
277 audio_manager_->GetAudioInputDeviceNames(&device_names); | 268 audio_manager_->GetAudioInputDeviceNames(&device_names); |
278 CheckDeviceNames(device_names); | 269 CheckDeviceNames(device_names); |
(...skipping 15 matching lines...) Expand all Loading... |
294 } | 285 } |
295 | 286 |
296 #endif // defined(OS_WIN) | 287 #endif // defined(OS_WIN) |
297 | 288 |
298 #if defined(USE_PULSEAUDIO) | 289 #if defined(USE_PULSEAUDIO) |
299 // On Linux, there are two implementations available and both can | 290 // On Linux, there are two implementations available and both can |
300 // sometimes be tested on a single system. These tests specifically | 291 // sometimes be tested on a single system. These tests specifically |
301 // test Pulseaudio. | 292 // test Pulseaudio. |
302 | 293 |
303 TEST_F(AudioManagerTest, EnumerateInputDevicesPulseaudio) { | 294 TEST_F(AudioManagerTest, EnumerateInputDevicesPulseaudio) { |
304 if (!CanRunInputTest()) | 295 ABORT_AUDIO_TEST_IF_NOT(InputDevicesAvailable()); |
305 return; | |
306 | 296 |
307 CreateAudioManagerForTesting<AudioManagerPulse>(); | 297 CreateAudioManagerForTesting<AudioManagerPulse>(); |
308 if (audio_manager_.get()) { | 298 if (audio_manager_.get()) { |
309 AudioDeviceNames device_names; | 299 AudioDeviceNames device_names; |
310 audio_manager_->GetAudioInputDeviceNames(&device_names); | 300 audio_manager_->GetAudioInputDeviceNames(&device_names); |
311 CheckDeviceNames(device_names); | 301 CheckDeviceNames(device_names); |
312 } else { | 302 } else { |
313 LOG(WARNING) << "No pulseaudio on this system."; | 303 LOG(WARNING) << "No pulseaudio on this system."; |
314 } | 304 } |
315 } | 305 } |
316 | 306 |
317 TEST_F(AudioManagerTest, EnumerateOutputDevicesPulseaudio) { | 307 TEST_F(AudioManagerTest, EnumerateOutputDevicesPulseaudio) { |
318 if (!CanRunOutputTest()) | 308 ABORT_AUDIO_TEST_IF_NOT(OutputDevicesAvailable()); |
319 return; | |
320 | 309 |
321 CreateAudioManagerForTesting<AudioManagerPulse>(); | 310 CreateAudioManagerForTesting<AudioManagerPulse>(); |
322 if (audio_manager_.get()) { | 311 if (audio_manager_.get()) { |
323 AudioDeviceNames device_names; | 312 AudioDeviceNames device_names; |
324 audio_manager_->GetAudioOutputDeviceNames(&device_names); | 313 audio_manager_->GetAudioOutputDeviceNames(&device_names); |
325 CheckDeviceNames(device_names); | 314 CheckDeviceNames(device_names); |
326 } else { | 315 } else { |
327 LOG(WARNING) << "No pulseaudio on this system."; | 316 LOG(WARNING) << "No pulseaudio on this system."; |
328 } | 317 } |
329 } | 318 } |
330 #endif // defined(USE_PULSEAUDIO) | 319 #endif // defined(USE_PULSEAUDIO) |
331 | 320 |
332 #if defined(USE_ALSA) | 321 #if defined(USE_ALSA) |
333 // On Linux, there are two implementations available and both can | 322 // On Linux, there are two implementations available and both can |
334 // sometimes be tested on a single system. These tests specifically | 323 // sometimes be tested on a single system. These tests specifically |
335 // test Alsa. | 324 // test Alsa. |
336 | 325 |
337 TEST_F(AudioManagerTest, EnumerateInputDevicesAlsa) { | 326 TEST_F(AudioManagerTest, EnumerateInputDevicesAlsa) { |
338 if (!CanRunInputTest()) | 327 ABORT_AUDIO_TEST_IF_NOT(InputDevicesAvailable()); |
339 return; | |
340 | 328 |
341 DVLOG(2) << "Testing AudioManagerAlsa."; | 329 DVLOG(2) << "Testing AudioManagerAlsa."; |
342 CreateAudioManagerForTesting<AudioManagerAlsa>(); | 330 CreateAudioManagerForTesting<AudioManagerAlsa>(); |
343 AudioDeviceNames device_names; | 331 AudioDeviceNames device_names; |
344 audio_manager_->GetAudioInputDeviceNames(&device_names); | 332 audio_manager_->GetAudioInputDeviceNames(&device_names); |
345 CheckDeviceNames(device_names); | 333 CheckDeviceNames(device_names); |
346 } | 334 } |
347 | 335 |
348 TEST_F(AudioManagerTest, EnumerateOutputDevicesAlsa) { | 336 TEST_F(AudioManagerTest, EnumerateOutputDevicesAlsa) { |
349 if (!CanRunOutputTest()) | 337 ABORT_AUDIO_TEST_IF_NOT(OutputDevicesAvailable()); |
350 return; | |
351 | 338 |
352 DVLOG(2) << "Testing AudioManagerAlsa."; | 339 DVLOG(2) << "Testing AudioManagerAlsa."; |
353 CreateAudioManagerForTesting<AudioManagerAlsa>(); | 340 CreateAudioManagerForTesting<AudioManagerAlsa>(); |
354 AudioDeviceNames device_names; | 341 AudioDeviceNames device_names; |
355 audio_manager_->GetAudioOutputDeviceNames(&device_names); | 342 audio_manager_->GetAudioOutputDeviceNames(&device_names); |
356 CheckDeviceNames(device_names); | 343 CheckDeviceNames(device_names); |
357 } | 344 } |
358 #endif // defined(USE_ALSA) | 345 #endif // defined(USE_ALSA) |
359 | 346 |
360 TEST_F(AudioManagerTest, GetDefaultOutputStreamParameters) { | 347 TEST_F(AudioManagerTest, GetDefaultOutputStreamParameters) { |
361 #if defined(OS_WIN) || defined(OS_MACOSX) | 348 #if defined(OS_WIN) || defined(OS_MACOSX) |
362 if (!CanRunInputTest()) | 349 ABORT_AUDIO_TEST_IF_NOT(InputDevicesAvailable()); |
363 return; | |
364 | 350 |
365 AudioParameters params = audio_manager_->GetDefaultOutputStreamParameters(); | 351 AudioParameters params = audio_manager_->GetDefaultOutputStreamParameters(); |
366 EXPECT_TRUE(params.IsValid()); | 352 EXPECT_TRUE(params.IsValid()); |
367 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 353 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
368 } | 354 } |
369 | 355 |
370 TEST_F(AudioManagerTest, GetAssociatedOutputDeviceID) { | 356 TEST_F(AudioManagerTest, GetAssociatedOutputDeviceID) { |
371 #if defined(OS_WIN) || defined(OS_MACOSX) | 357 #if defined(OS_WIN) || defined(OS_MACOSX) |
372 if (!CanRunInputTest() || !CanRunOutputTest()) | 358 ABORT_AUDIO_TEST_IF_NOT(InputDevicesAvailable() && OutputDevicesAvailable()); |
373 return; | |
374 | 359 |
375 AudioDeviceNames device_names; | 360 AudioDeviceNames device_names; |
376 audio_manager_->GetAudioInputDeviceNames(&device_names); | 361 audio_manager_->GetAudioInputDeviceNames(&device_names); |
377 bool found_an_associated_device = false; | 362 bool found_an_associated_device = false; |
378 for (AudioDeviceNames::iterator it = device_names.begin(); | 363 for (AudioDeviceNames::iterator it = device_names.begin(); |
379 it != device_names.end(); | 364 it != device_names.end(); |
380 ++it) { | 365 ++it) { |
381 EXPECT_FALSE(it->unique_id.empty()); | 366 EXPECT_FALSE(it->unique_id.empty()); |
382 EXPECT_FALSE(it->device_name.empty()); | 367 EXPECT_FALSE(it->device_name.empty()); |
383 std::string output_device_id( | 368 std::string output_device_id( |
384 audio_manager_->GetAssociatedOutputDeviceID(it->unique_id)); | 369 audio_manager_->GetAssociatedOutputDeviceID(it->unique_id)); |
385 if (!output_device_id.empty()) { | 370 if (!output_device_id.empty()) { |
386 DVLOG(2) << it->unique_id << " matches with " << output_device_id; | 371 DVLOG(2) << it->unique_id << " matches with " << output_device_id; |
387 found_an_associated_device = true; | 372 found_an_associated_device = true; |
388 } | 373 } |
389 } | 374 } |
390 | 375 |
391 EXPECT_TRUE(found_an_associated_device); | 376 EXPECT_TRUE(found_an_associated_device); |
392 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 377 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
393 } | 378 } |
394 | 379 |
395 } // namespace media | 380 } // namespace media |
OLD | NEW |