| 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/logging.h" | 5 #include "base/logging.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "media/audio/audio_manager.h" | 7 #include "media/audio/audio_manager.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 #if defined(OS_LINUX) | 10 #if defined(OS_LINUX) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 for (AudioDeviceNames::iterator it = device_names.begin(); | 25 for (AudioDeviceNames::iterator it = device_names.begin(); |
| 26 it != device_names.end(); | 26 it != device_names.end(); |
| 27 ++it) { | 27 ++it) { |
| 28 EXPECT_FALSE(it->unique_id.empty()); | 28 EXPECT_FALSE(it->unique_id.empty()); |
| 29 EXPECT_FALSE(it->device_name.empty()); | 29 EXPECT_FALSE(it->device_name.empty()); |
| 30 VLOG(2) << "Device ID(" << it->unique_id << "), label: " << it->device_name; | 30 VLOG(2) << "Device ID(" << it->unique_id << "), label: " << it->device_name; |
| 31 } | 31 } |
| 32 } | 32 } |
| 33 | 33 |
| 34 TEST(AudioManagerTest, GetAudioOutputDeviceNames) { | 34 TEST(AudioManagerTest, GetAudioOutputDeviceNames) { |
| 35 // On Linux, we may be able to test both the Alsa and Pulseaudio |
| 36 // versions of the audio manager. |
| 35 #if defined(USE_PULSEAUDIO) | 37 #if defined(USE_PULSEAUDIO) |
| 36 { | 38 { |
| 37 VLOG(2) << "Testing AudioManagerPulse."; | 39 VLOG(2) << "Testing AudioManagerPulse."; |
| 38 scoped_ptr<AudioManager> pulse_audio_manager(AudioManagerPulse::Create()); | 40 scoped_ptr<AudioManager> pulse_audio_manager(AudioManagerPulse::Create()); |
| 39 if (pulse_audio_manager.get()) | 41 if (pulse_audio_manager.get()) |
| 40 GetAudioOutputDeviceNamesImpl(pulse_audio_manager.get()); | 42 GetAudioOutputDeviceNamesImpl(pulse_audio_manager.get()); |
| 41 else | 43 else |
| 42 LOG(WARNING) << "No pulseaudio on this system."; | 44 LOG(WARNING) << "No pulseaudio on this system."; |
| 43 } | 45 } |
| 44 #endif // defined(USE_PULSEAUDIO) | 46 #endif // defined(USE_PULSEAUDIO) |
| 45 #if defined(USE_ALSA) | 47 #if defined(USE_ALSA) |
| 46 { | 48 { |
| 47 VLOG(2) << "Testing AudioManagerLinux."; | 49 VLOG(2) << "Testing AudioManagerLinux."; |
| 48 scoped_ptr<AudioManager> alsa_audio_manager(new AudioManagerLinux()); | 50 scoped_ptr<AudioManager> alsa_audio_manager(new AudioManagerLinux()); |
| 49 GetAudioOutputDeviceNamesImpl(alsa_audio_manager.get()); | 51 GetAudioOutputDeviceNamesImpl(alsa_audio_manager.get()); |
| 50 } | 52 } |
| 51 #endif // defined(USE_ALSA) | 53 #endif // defined(USE_ALSA) |
| 54 |
| 55 #if defined(OS_MACOSX) |
| 56 VLOG(2) << "Testing platform-default AudioManager."; |
| 57 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); |
| 58 GetAudioOutputDeviceNamesImpl(audio_manager.get()); |
| 59 #endif // defined(OS_MACOSX) |
| 52 } | 60 } |
| 53 | 61 |
| 54 } // namespace media | 62 } // namespace media |
| OLD | NEW |