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

Side by Side 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: Fix apparent sdk build problem 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/audio/audio_input_device.cc ('k') | media/audio/mac/audio_low_latency_input_mac.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/logging.h" 5 #include "base/logging.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "media/audio/audio_manager.h" 7 #include "media/audio/audio_manager.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 #if defined(USE_PULSEAUDIO) 10 #if defined(USE_PULSEAUDIO)
(...skipping 16 matching lines...) Expand all
27 for (AudioDeviceNames::iterator it = device_names.begin(); 27 for (AudioDeviceNames::iterator it = device_names.begin();
28 it != device_names.end(); 28 it != device_names.end();
29 ++it) { 29 ++it) {
30 EXPECT_FALSE(it->unique_id.empty()); 30 EXPECT_FALSE(it->unique_id.empty());
31 EXPECT_FALSE(it->device_name.empty()); 31 EXPECT_FALSE(it->device_name.empty());
32 VLOG(2) << "Device ID(" << it->unique_id << "), label: " << it->device_name; 32 VLOG(2) << "Device ID(" << it->unique_id << "), label: " << it->device_name;
33 } 33 }
34 #endif // defined(USE_PULSEAUDIO) 34 #endif // defined(USE_PULSEAUDIO)
35 } 35 }
36 36
37 TEST(AudioManagerTest, GetDefaultOutputStreamParameters) {
38 #if defined(OS_WIN) || defined(OS_MACOSX)
39 scoped_ptr<AudioManager> audio_manager(AudioManager::Create());
40 ASSERT_TRUE(audio_manager);
41 if (!audio_manager->HasAudioOutputDevices())
42 return;
43
44 AudioParameters params = audio_manager->GetDefaultOutputStreamParameters();
45 EXPECT_TRUE(params.IsValid());
46 #endif // defined(OS_WIN) || defined(OS_MACOSX)
47 }
48
49 TEST(AudioManagerTest, GetAssociatedOutputDeviceID) {
50 #if defined(OS_WIN) || defined(OS_MACOSX)
51 scoped_ptr<AudioManager> audio_manager(AudioManager::Create());
52 ASSERT_TRUE(audio_manager);
53 if (!audio_manager->HasAudioOutputDevices() ||
54 !audio_manager->HasAudioInputDevices()) {
55 return;
56 }
57
58 AudioDeviceNames device_names;
59 audio_manager->GetAudioInputDeviceNames(&device_names);
60 bool found_an_associated_device = false;
61 for (AudioDeviceNames::iterator it = device_names.begin();
62 it != device_names.end();
63 ++it) {
64 EXPECT_FALSE(it->unique_id.empty());
65 EXPECT_FALSE(it->device_name.empty());
66 std::string output_device_id(
67 audio_manager->GetAssociatedOutputDeviceID(it->unique_id));
68 if (!output_device_id.empty()) {
69 VLOG(2) << it->unique_id << " matches with " << output_device_id;
70 found_an_associated_device = true;
71 }
72 }
73
74 EXPECT_TRUE(found_an_associated_device);
75 #endif // defined(OS_WIN) || defined(OS_MACOSX)
76 }
37 } // namespace media 77 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_input_device.cc ('k') | media/audio/mac/audio_low_latency_input_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698