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

Side by Side Diff: media/audio/win/audio_low_latency_input_win_unittest.cc

Issue 2563653002: Replace AudioManager::GetAudio*DeviceNames with AudioManager::GetAudio*DeviceDescriptions (Closed)
Patch Set: fix for windows Created 4 years 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
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 "media/audio/win/audio_low_latency_input_win.h" 5 #include "media/audio/win/audio_low_latency_input_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <mmsystem.h> 8 #include <mmsystem.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 base::MessageLoop message_loop_; 272 base::MessageLoop message_loop_;
273 ScopedAudioManagerPtr audio_manager_; 273 ScopedAudioManagerPtr audio_manager_;
274 }; 274 };
275 275
276 // Verify that we can retrieve the current hardware/mixing sample rate 276 // Verify that we can retrieve the current hardware/mixing sample rate
277 // for all available input devices. 277 // for all available input devices.
278 TEST_F(WinAudioInputTest, WASAPIAudioInputStreamHardwareSampleRate) { 278 TEST_F(WinAudioInputTest, WASAPIAudioInputStreamHardwareSampleRate) {
279 ABORT_AUDIO_TEST_IF_NOT(HasCoreAudioAndInputDevices(audio_manager_.get())); 279 ABORT_AUDIO_TEST_IF_NOT(HasCoreAudioAndInputDevices(audio_manager_.get()));
280 280
281 // Retrieve a list of all available input devices. 281 // Retrieve a list of all available input devices.
282 media::AudioDeviceNames device_names; 282 media::AudioDeviceDescriptions device_descriptions;
283 audio_manager_->GetAudioInputDeviceNames(&device_names); 283 audio_manager_->GetAudioInputDeviceDescriptions(&device_descriptions);
284 284
285 // Scan all available input devices and repeat the same test for all of them. 285 // Scan all available input devices and repeat the same test for all of them.
286 for (media::AudioDeviceNames::const_iterator it = device_names.begin(); 286 for (media::AudioDeviceDescriptions::const_iterator it =
Guido Urdaneta 2016/12/08 15:53:37 consider switching to range for
o1ka 2016/12/09 14:56:30 Done.
287 it != device_names.end(); ++it) { 287 device_descriptions.begin();
288 it != device_descriptions.end(); ++it) {
288 // Retrieve the hardware sample rate given a specified audio input device. 289 // Retrieve the hardware sample rate given a specified audio input device.
289 AudioParameters params; 290 AudioParameters params;
290 ASSERT_TRUE(SUCCEEDED(CoreAudioUtil::GetPreferredAudioParameters( 291 ASSERT_TRUE(SUCCEEDED(CoreAudioUtil::GetPreferredAudioParameters(
291 it->unique_id, false, &params))); 292 it->unique_id, false, &params)));
292 EXPECT_GE(params.sample_rate(), 0); 293 EXPECT_GE(params.sample_rate(), 0);
293 } 294 }
294 } 295 }
295 296
296 // Test Create(), Close() calling sequence. 297 // Test Create(), Close() calling sequence.
297 TEST_F(WinAudioInputTest, WASAPIAudioInputStreamCreateAndClose) { 298 TEST_F(WinAudioInputTest, WASAPIAudioInputStreamCreateAndClose) {
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 WriteToFileAudioSink file_sink(file_name, aisw.bits_per_sample()); 495 WriteToFileAudioSink file_sink(file_name, aisw.bits_per_sample());
495 VLOG(0) << ">> Speak into the default microphone while recording."; 496 VLOG(0) << ">> Speak into the default microphone while recording.";
496 ais->Start(&file_sink); 497 ais->Start(&file_sink);
497 base::PlatformThread::Sleep(TestTimeouts::action_timeout()); 498 base::PlatformThread::Sleep(TestTimeouts::action_timeout());
498 ais->Stop(); 499 ais->Stop();
499 VLOG(0) << ">> Recording has stopped."; 500 VLOG(0) << ">> Recording has stopped.";
500 ais.Close(); 501 ais.Close();
501 } 502 }
502 503
503 } // namespace media 504 } // namespace media
OLDNEW
« media/audio/audio_manager_unittest.cc ('K') | « media/audio/mock_audio_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698