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