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

Side by Side Diff: media/audio/audio_input_volume_unittest.cc

Issue 9570014: Move some generic functions to AudioManagerBase to be inherited by platform-specific AudioManager*** (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: changed the GetMaxOutputStreamsAllowed Created 8 years, 9 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
OLDNEW
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 <cmath> 5 #include <cmath>
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/win/scoped_com_initializer.h" 8 #include "base/win/scoped_com_initializer.h"
9 #include "media/audio/audio_io.h" 9 #include "media/audio/audio_io.h"
10 #include "media/audio/audio_manager_base.h" 10 #include "media/audio/audio_manager_base.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 scoped_ptr<AudioManager> audio_manager_; 88 scoped_ptr<AudioManager> audio_manager_;
89 ScopedCOMInitializer com_init_; 89 ScopedCOMInitializer com_init_;
90 }; 90 };
91 91
92 TEST_F(AudioInputVolumeTest, InputVolumeTest) { 92 TEST_F(AudioInputVolumeTest, InputVolumeTest) {
93 if (!CanRunAudioTests()) 93 if (!CanRunAudioTests())
94 return; 94 return;
95 95
96 AudioDeviceNames device_names; 96 AudioDeviceNames device_names;
97 audio_manager_->GetAudioInputDeviceNames(&device_names); 97 audio_manager_->GetAudioInputDeviceNames(&device_names);
98 DCHECK(!device_names.empty()); 98 if (device_names.empty()) {
99 LOG(WARNING) << "Could not find any available input device";
100 return;
101 }
99 102
100 for (AudioDeviceNames::const_iterator it = device_names.begin(); 103 for (AudioDeviceNames::const_iterator it = device_names.begin();
101 it != device_names.end(); 104 it != device_names.end();
102 ++it) { 105 ++it) {
103 AudioInputStream* ais = CreateAndOpenStream(it->unique_id); 106 AudioInputStream* ais = CreateAndOpenStream(it->unique_id);
104 if (!ais) { 107 if (!ais) {
105 DLOG(WARNING) << "Failed to open stream for device " << it->unique_id; 108 DLOG(WARNING) << "Failed to open stream for device " << it->unique_id;
106 continue; 109 continue;
107 } 110 }
108 111
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 EXPECT_GT(current_volume, 0); 145 EXPECT_GT(current_volume, 0);
143 146
144 // Restores the volume to the original value. 147 // Restores the volume to the original value.
145 ais->SetVolume(original_volume); 148 ais->SetVolume(original_volume);
146 current_volume = ais->GetVolume(); 149 current_volume = ais->GetVolume();
147 EXPECT_EQ(original_volume, current_volume); 150 EXPECT_EQ(original_volume, current_volume);
148 151
149 ais->Close(); 152 ais->Close();
150 } 153 }
151 } 154 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698