Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(724)

Unified Diff: media/audio/audio_manager_unittest.cc

Issue 2646423005: Remove the wave based audio capture implementation for Windows (Closed)
Patch Set: Minor cleanup + documentation Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/audio/BUILD.gn ('k') | media/audio/win/audio_device_listener_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_manager_unittest.cc
diff --git a/media/audio/audio_manager_unittest.cc b/media/audio/audio_manager_unittest.cc
index 75925150e36ca1481162ad7e750e5c3471a574de..7635e645160c283a868ffffa39d56cf9c0cae6e1 100644
--- a/media/audio/audio_manager_unittest.cc
+++ b/media/audio/audio_manager_unittest.cc
@@ -31,7 +31,6 @@
#if defined(OS_WIN)
#include "base/win/scoped_com_initializer.h"
#include "media/audio/win/audio_manager_win.h"
-#include "media/audio/win/wavein_input_win.h"
#endif
#if defined(USE_PULSEAUDIO)
@@ -233,37 +232,6 @@ class AudioManagerTest : public ::testing::Test {
AudioManagerTest() { CreateAudioManagerForTesting(); }
~AudioManagerTest() override {}
-#if defined(OS_WIN)
- bool SetMMDeviceEnumeration() {
- AudioManagerWin* amw = static_cast<AudioManagerWin*>(audio_manager_.get());
- // Windows Wave is used as default if Windows XP was detected =>
- // return false since MMDevice is not supported on XP.
- if (amw->enumeration_type() == AudioManagerWin::kWaveEnumeration)
- return false;
-
- amw->SetEnumerationType(AudioManagerWin::kMMDeviceEnumeration);
- return true;
- }
-
- void SetWaveEnumeration() {
- AudioManagerWin* amw = static_cast<AudioManagerWin*>(audio_manager_.get());
- amw->SetEnumerationType(AudioManagerWin::kWaveEnumeration);
- }
-
- std::string GetDeviceIdFromPCMWaveInAudioInputStream(
- const std::string& device_id) {
- AudioManagerWin* amw = static_cast<AudioManagerWin*>(audio_manager_.get());
- AudioParameters parameters(
- AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_STEREO,
- AudioParameters::kAudioCDSampleRate, 16,
- 1024);
- std::unique_ptr<PCMWaveInAudioInputStream> stream(
- static_cast<PCMWaveInAudioInputStream*>(
- amw->CreatePCMWaveInAudioInputStream(parameters, device_id)));
- return stream.get() ? stream->device_id_ : std::string();
- }
-#endif
-
// Helper method which verifies that the device list starts with a valid
// default record followed by non-default device names.
static void CheckDeviceDescriptions(
@@ -479,11 +447,6 @@ TEST_F(AudioManagerTest, EnumerateInputDevicesWinMMDevice) {
ABORT_AUDIO_TEST_IF_NOT(InputDevicesAvailable());
AudioDeviceDescriptions device_descriptions;
- if (!SetMMDeviceEnumeration()) {
- // Usage of MMDevice will fail on XP and lower.
- LOG(WARNING) << "MM device enumeration is not supported.";
- return;
- }
audio_manager_->GetAudioInputDeviceDescriptions(&device_descriptions);
CheckDeviceDescriptions(device_descriptions);
}
@@ -492,79 +455,9 @@ TEST_F(AudioManagerTest, EnumerateOutputDevicesWinMMDevice) {
ABORT_AUDIO_TEST_IF_NOT(OutputDevicesAvailable());
AudioDeviceDescriptions device_descriptions;
- if (!SetMMDeviceEnumeration()) {
- // Usage of MMDevice will fail on XP and lower.
- LOG(WARNING) << "MM device enumeration is not supported.";
- return;
- }
- audio_manager_->GetAudioOutputDeviceDescriptions(&device_descriptions);
- CheckDeviceDescriptions(device_descriptions);
-}
-
-// Override default enumeration API and force usage of Windows Wave.
-// This test will run on Windows XP, Windows Vista and Windows 7.
-TEST_F(AudioManagerTest, EnumerateInputDevicesWinWave) {
- ABORT_AUDIO_TEST_IF_NOT(InputDevicesAvailable());
-
- AudioDeviceDescriptions device_descriptions;
- SetWaveEnumeration();
- audio_manager_->GetAudioInputDeviceDescriptions(&device_descriptions);
- CheckDeviceDescriptions(device_descriptions);
-}
-
-TEST_F(AudioManagerTest, EnumerateOutputDevicesWinWave) {
- ABORT_AUDIO_TEST_IF_NOT(OutputDevicesAvailable());
-
- AudioDeviceDescriptions device_descriptions;
- SetWaveEnumeration();
audio_manager_->GetAudioOutputDeviceDescriptions(&device_descriptions);
CheckDeviceDescriptions(device_descriptions);
}
-
-TEST_F(AudioManagerTest, WinXPDeviceIdUnchanged) {
- ABORT_AUDIO_TEST_IF_NOT(InputDevicesAvailable());
-
- AudioDeviceDescriptions xp_device_descriptions;
- SetWaveEnumeration();
- audio_manager_->GetAudioInputDeviceDescriptions(&xp_device_descriptions);
- CheckDeviceDescriptions(xp_device_descriptions);
-
- // Device ID should remain unchanged, including the default device ID.
- for (const auto& description : xp_device_descriptions) {
- EXPECT_EQ(description.unique_id,
- GetDeviceIdFromPCMWaveInAudioInputStream(description.unique_id));
- }
-}
-
-TEST_F(AudioManagerTest, ConvertToWinXPInputDeviceId) {
- ABORT_AUDIO_TEST_IF_NOT(InputDevicesAvailable());
-
- if (!SetMMDeviceEnumeration()) {
- // Usage of MMDevice will fail on XP and lower.
- LOG(WARNING) << "MM device enumeration is not supported.";
- return;
- }
-
- AudioDeviceDescriptions device_descriptions;
- audio_manager_->GetAudioInputDeviceDescriptions(&device_descriptions);
- CheckDeviceDescriptions(device_descriptions);
-
- for (AudioDeviceDescriptions::iterator i = device_descriptions.begin();
- i != device_descriptions.end(); ++i) {
- std::string converted_id =
- GetDeviceIdFromPCMWaveInAudioInputStream(i->unique_id);
- if (i == device_descriptions.begin()) {
- // The first in the list is the default device ID, which should not be
- // changed when passed to PCMWaveInAudioInputStream.
- EXPECT_EQ(i->unique_id, converted_id);
- } else {
- // MMDevice-style device IDs should be converted to WaveIn-style device
- // IDs.
- EXPECT_NE(i->unique_id, converted_id);
- }
- }
-}
-
#endif // defined(OS_WIN)
#if defined(USE_PULSEAUDIO)
« no previous file with comments | « media/audio/BUILD.gn ('k') | media/audio/win/audio_device_listener_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698