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

Unified Diff: media/audio/audio_manager_unittest.cc

Issue 23533045: Implement GetDefaultOutputDeviceID, GetAssociatedOutputDeviceID and ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | « no previous file | media/audio/mac/audio_manager_mac.h » ('j') | media/audio/mac/audio_manager_mac.cc » ('J')
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 5063d073167c62438bd91834ac827a3655e5201f..e0a73f0e53193b4f315a5d24ca41690ec6a3bad1 100644
--- a/media/audio/audio_manager_unittest.cc
+++ b/media/audio/audio_manager_unittest.cc
@@ -34,4 +34,44 @@ TEST(AudioManagerTest, GetAudioOutputDeviceNames) {
#endif // defined(USE_PULSEAUDIO)
}
+TEST(AudioManagerTest, GetDefaultOutputStreamParameters) {
+#if defined(OS_WIN) || defined(OS_MACOSX)
henrika (OOO until Aug 14) 2013/09/07 08:04:25 Why inside and not outside the complete method?
tommi (sloooow) - chröme 2013/09/08 19:11:19 I'm following the style of the other test in this
+ scoped_ptr<AudioManager> audio_manager(AudioManager::Create());
+ ASSERT_TRUE(audio_manager);
+ if (!audio_manager->HasAudioOutputDevices())
+ return;
+
+ AudioParameters params = audio_manager->GetDefaultOutputStreamParameters();
+ EXPECT_TRUE(params.IsValid());
+#endif // defined(OS_WIN) || defined(OS_MACOSX)
+}
+
+TEST(AudioManagerTest, GetAssociatedOutputDeviceID) {
+#if defined(OS_WIN) || defined(OS_MACOSX)
+ scoped_ptr<AudioManager> audio_manager(AudioManager::Create());
+ ASSERT_TRUE(audio_manager);
+ if (!audio_manager->HasAudioOutputDevices() ||
+ !audio_manager->HasAudioInputDevices()) {
+ return;
+ }
+
+ AudioDeviceNames device_names;
+ audio_manager->GetAudioInputDeviceNames(&device_names);
+ bool found_an_associated_device = false;
+ for (AudioDeviceNames::iterator it = device_names.begin();
+ it != device_names.end();
+ ++it) {
+ EXPECT_FALSE(it->unique_id.empty());
+ EXPECT_FALSE(it->device_name.empty());
+ std::string output_device_id(
+ audio_manager->GetAssociatedOutputDeviceID(it->unique_id));
+ if (!output_device_id.empty()) {
+ VLOG(2) << it->unique_id << " matches with " << output_device_id;
+ found_an_associated_device = true;
+ }
+ }
+
+ EXPECT_TRUE(found_an_associated_device);
henrika (OOO until Aug 14) 2013/09/07 08:04:25 Are we sure that this will be true on all boths wi
tommi (sloooow) - chröme 2013/09/08 19:11:19 I think it's a reasonable thing to expect (we have
+#endif // defined(OS_WIN) || defined(OS_MACOSX)
+}
} // namespace media
« no previous file with comments | « no previous file | media/audio/mac/audio_manager_mac.h » ('j') | media/audio/mac/audio_manager_mac.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698