| 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 "media/audio/win/core_audio_util_win.h" | 5 #include "media/audio/win/core_audio_util_win.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
| 13 #include "base/win/scoped_co_mem.h" | 13 #include "base/win/scoped_co_mem.h" |
| 14 #include "base/win/scoped_com_initializer.h" | 14 #include "base/win/scoped_com_initializer.h" |
| 15 #include "base/win/scoped_handle.h" | 15 #include "base/win/scoped_handle.h" |
| 16 #include "media/audio/audio_manager_base.h" | 16 #include "media/audio/audio_device_description.h" |
| 17 #include "media/audio/audio_unittest_util.h" | 17 #include "media/audio/audio_unittest_util.h" |
| 18 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 20 | 20 |
| 21 using base::win::ScopedCOMInitializer; | 21 using base::win::ScopedCOMInitializer; |
| 22 | 22 |
| 23 namespace media { | 23 namespace media { |
| 24 | 24 |
| 25 class CoreAudioUtilWinTest : public ::testing::Test { | 25 class CoreAudioUtilWinTest : public ::testing::Test { |
| 26 protected: | 26 protected: |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 } | 262 } |
| 263 | 263 |
| 264 TEST_F(CoreAudioUtilWinTest, IsChannelLayoutSupported) { | 264 TEST_F(CoreAudioUtilWinTest, IsChannelLayoutSupported) { |
| 265 ABORT_AUDIO_TEST_IF_NOT(DevicesAvailable()); | 265 ABORT_AUDIO_TEST_IF_NOT(DevicesAvailable()); |
| 266 | 266 |
| 267 // The preferred channel layout should always be supported. Being supported | 267 // The preferred channel layout should always be supported. Being supported |
| 268 // means that it is possible to initialize a shared mode stream with the | 268 // means that it is possible to initialize a shared mode stream with the |
| 269 // particular channel layout. | 269 // particular channel layout. |
| 270 AudioParameters mix_params; | 270 AudioParameters mix_params; |
| 271 HRESULT hr = CoreAudioUtil::GetPreferredAudioParameters( | 271 HRESULT hr = CoreAudioUtil::GetPreferredAudioParameters( |
| 272 AudioManagerBase::kDefaultDeviceId, true, &mix_params); | 272 AudioDeviceDescription::kDefaultDeviceId, true, &mix_params); |
| 273 EXPECT_TRUE(SUCCEEDED(hr)); | 273 EXPECT_TRUE(SUCCEEDED(hr)); |
| 274 EXPECT_TRUE(mix_params.IsValid()); | 274 EXPECT_TRUE(mix_params.IsValid()); |
| 275 EXPECT_TRUE(CoreAudioUtil::IsChannelLayoutSupported( | 275 EXPECT_TRUE(CoreAudioUtil::IsChannelLayoutSupported( |
| 276 std::string(), eRender, eConsole, mix_params.channel_layout())); | 276 std::string(), eRender, eConsole, mix_params.channel_layout())); |
| 277 | 277 |
| 278 // Check if it is possible to modify the channel layout to stereo for a | 278 // Check if it is possible to modify the channel layout to stereo for a |
| 279 // device which reports that it prefers to be openen up in an other | 279 // device which reports that it prefers to be openen up in an other |
| 280 // channel configuration. | 280 // channel configuration. |
| 281 if (mix_params.channel_layout() != CHANNEL_LAYOUT_STEREO) { | 281 if (mix_params.channel_layout() != CHANNEL_LAYOUT_STEREO) { |
| 282 ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; | 282 ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 } | 503 } |
| 504 | 504 |
| 505 TEST_F(CoreAudioUtilWinTest, GetDefaultOutputDeviceID) { | 505 TEST_F(CoreAudioUtilWinTest, GetDefaultOutputDeviceID) { |
| 506 ABORT_AUDIO_TEST_IF_NOT(DevicesAvailable()); | 506 ABORT_AUDIO_TEST_IF_NOT(DevicesAvailable()); |
| 507 | 507 |
| 508 std::string default_device_id(CoreAudioUtil::GetDefaultOutputDeviceID()); | 508 std::string default_device_id(CoreAudioUtil::GetDefaultOutputDeviceID()); |
| 509 EXPECT_FALSE(default_device_id.empty()); | 509 EXPECT_FALSE(default_device_id.empty()); |
| 510 } | 510 } |
| 511 | 511 |
| 512 } // namespace media | 512 } // namespace media |
| OLD | NEW |