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

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: rebased and fixed windows compiling 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
« no previous file with comments | « media/audio/android/audio_manager_android.cc ('k') | media/audio/audio_manager_base.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 (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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 ScopedCOMInitializer com_init_; 90 ScopedCOMInitializer com_init_;
91 }; 91 };
92 92
93 TEST_F(AudioInputVolumeTest, InputVolumeTest) { 93 TEST_F(AudioInputVolumeTest, InputVolumeTest) {
94 if (!CanRunAudioTests()) 94 if (!CanRunAudioTests())
95 return; 95 return;
96 96
97 // Retrieve a list of all available input devices. 97 // Retrieve a list of all available input devices.
98 AudioDeviceNames device_names; 98 AudioDeviceNames device_names;
99 audio_manager_->GetAudioInputDeviceNames(&device_names); 99 audio_manager_->GetAudioInputDeviceNames(&device_names);
100 DCHECK(!device_names.empty()); 100 if (device_names.empty()) {
101 LOG(WARNING) << "Could not find any available input device";
102 return;
103 }
101 104
102 // Scan all available input devices and repeat the same test for all of them. 105 // Scan all available input devices and repeat the same test for all of them.
103 for (AudioDeviceNames::const_iterator it = device_names.begin(); 106 for (AudioDeviceNames::const_iterator it = device_names.begin();
104 it != device_names.end(); 107 it != device_names.end();
105 ++it) { 108 ++it) {
106 AudioInputStream* ais = CreateAndOpenStream(it->unique_id); 109 AudioInputStream* ais = CreateAndOpenStream(it->unique_id);
107 if (!ais) { 110 if (!ais) {
108 DLOG(WARNING) << "Failed to open stream for device " << it->unique_id; 111 DLOG(WARNING) << "Failed to open stream for device " << it->unique_id;
109 continue; 112 continue;
110 } 113 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 EXPECT_NEAR(current_volume, new_volume, 0.25 * max_volume); 151 EXPECT_NEAR(current_volume, new_volume, 0.25 * max_volume);
149 152
150 // Restores the volume to the original value. 153 // Restores the volume to the original value.
151 ais->SetVolume(original_volume); 154 ais->SetVolume(original_volume);
152 current_volume = ais->GetVolume(); 155 current_volume = ais->GetVolume();
153 EXPECT_EQ(original_volume, current_volume); 156 EXPECT_EQ(original_volume, current_volume);
154 157
155 ais->Close(); 158 ais->Close();
156 } 159 }
157 } 160 }
OLDNEW
« no previous file with comments | « media/audio/android/audio_manager_android.cc ('k') | media/audio/audio_manager_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698