| 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 #include "base/environment.h" | 5 #include "base/environment.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "media/audio/audio_manager.h" | 8 #include "media/audio/audio_manager.h" |
| 9 #include "media/audio/audio_manager_base.h" | 9 #include "media/audio/audio_manager_base.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 #if defined(OS_WIN) | 12 #if defined(OS_WIN) |
| 13 #include "base/win/scoped_com_initializer.h" | 13 #include "base/win/scoped_com_initializer.h" |
| 14 #include "media/audio/win/audio_manager_win.h" | 14 #include "media/audio/win/audio_manager_win.h" |
| 15 #include "media/audio/win/wavein_input_win.h" | 15 #include "media/audio/win/wavein_input_win.h" |
| 16 #endif | 16 #endif |
| 17 | 17 |
| 18 #if defined(OS_ANDROID) | |
| 19 #include "base/android/jni_android.h" | |
| 20 #include "media/audio/audio_manager_base.h" | |
| 21 #endif | |
| 22 | |
| 23 namespace media { | 18 namespace media { |
| 24 | 19 |
| 25 // Test fixture which allows us to override the default enumeration API on | 20 // Test fixture which allows us to override the default enumeration API on |
| 26 // Windows. | 21 // Windows. |
| 27 class AudioInputDeviceTest | 22 class AudioInputDeviceTest |
| 28 : public ::testing::Test { | 23 : public ::testing::Test { |
| 29 protected: | 24 protected: |
| 30 AudioInputDeviceTest() | 25 AudioInputDeviceTest() |
| 26 : audio_manager_(AudioManager::Create()) |
| 31 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
| 32 : com_init_(base::win::ScopedCOMInitializer::kMTA) | 28 , com_init_(base::win::ScopedCOMInitializer::kMTA) |
| 33 #endif | 29 #endif |
| 34 { | 30 { |
| 35 #if defined(OS_ANDROID) | |
| 36 media::AudioManagerBase::RegisterAudioManager( | |
| 37 base::android::AttachCurrentThread()); | |
| 38 #endif | |
| 39 audio_manager_.reset(AudioManager::Create()); | |
| 40 } | 31 } |
| 41 | 32 |
| 42 #if defined(OS_WIN) | 33 #if defined(OS_WIN) |
| 43 bool SetMMDeviceEnumeration() { | 34 bool SetMMDeviceEnumeration() { |
| 44 AudioManagerWin* amw = static_cast<AudioManagerWin*>(audio_manager_.get()); | 35 AudioManagerWin* amw = static_cast<AudioManagerWin*>(audio_manager_.get()); |
| 45 // Windows Wave is used as default if Windows XP was detected => | 36 // Windows Wave is used as default if Windows XP was detected => |
| 46 // return false since MMDevice is not supported on XP. | 37 // return false since MMDevice is not supported on XP. |
| 47 if (amw->enumeration_type() == AudioManagerWin::kWaveEnumeration) | 38 if (amw->enumeration_type() == AudioManagerWin::kWaveEnumeration) |
| 48 return false; | 39 return false; |
| 49 | 40 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 // MMDevice-style device IDs should be converted to WaveIn-style device | 190 // MMDevice-style device IDs should be converted to WaveIn-style device |
| 200 // IDs. | 191 // IDs. |
| 201 EXPECT_NE(i->unique_id, converted_id); | 192 EXPECT_NE(i->unique_id, converted_id); |
| 202 } | 193 } |
| 203 } | 194 } |
| 204 } | 195 } |
| 205 | 196 |
| 206 #endif | 197 #endif |
| 207 | 198 |
| 208 } // namespace media | 199 } // namespace media |
| OLD | NEW |