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

Unified Diff: media/audio/win/audio_low_latency_output_win_unittest.cc

Issue 1806313003: Pass task runners to AudioManager constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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 side-by-side diff with in-line comments
Download patch
Index: media/audio/win/audio_low_latency_output_win_unittest.cc
diff --git a/media/audio/win/audio_low_latency_output_win_unittest.cc b/media/audio/win/audio_low_latency_output_win_unittest.cc
index 5b748e7fc099ae941ef1959de5b563022d9230a7..530d8159c6d4bded542a033b5b7c8c889c3b251c 100644
--- a/media/audio/win/audio_low_latency_output_win_unittest.cc
+++ b/media/audio/win/audio_low_latency_output_win_unittest.cc
@@ -236,7 +236,9 @@ TEST(WASAPIAudioOutputStreamTest, HardwareSampleRate) {
// for shared mode streams.
if (ExclusiveModeIsEnabled())
return;
- scoped_ptr<AudioManager> audio_manager(AudioManager::CreateForTesting());
+ base::MessageLoop loop;
+ ScopedAudioManagerPtr audio_manager(
+ AudioManager::CreateForTesting(loop.task_runner()));
ABORT_AUDIO_TEST_IF_NOT(HasCoreAudioAndOutputDevices(audio_manager.get()));
// Default device intended for games, system notification sounds,
@@ -248,7 +250,9 @@ TEST(WASAPIAudioOutputStreamTest, HardwareSampleRate) {
// Test Create(), Close() calling sequence.
TEST(WASAPIAudioOutputStreamTest, CreateAndClose) {
- scoped_ptr<AudioManager> audio_manager(AudioManager::CreateForTesting());
+ base::MessageLoop loop;
+ ScopedAudioManagerPtr audio_manager(
+ AudioManager::CreateForTesting(loop.task_runner()));
ABORT_AUDIO_TEST_IF_NOT(HasCoreAudioAndOutputDevices(audio_manager.get()));
AudioOutputStream* aos = CreateDefaultAudioOutputStream(audio_manager.get());
aos->Close();
@@ -256,7 +260,9 @@ TEST(WASAPIAudioOutputStreamTest, CreateAndClose) {
// Test Open(), Close() calling sequence.
TEST(WASAPIAudioOutputStreamTest, OpenAndClose) {
- scoped_ptr<AudioManager> audio_manager(AudioManager::CreateForTesting());
+ base::MessageLoop loop;
+ ScopedAudioManagerPtr audio_manager(
+ AudioManager::CreateForTesting(loop.task_runner()));
ABORT_AUDIO_TEST_IF_NOT(HasCoreAudioAndOutputDevices(audio_manager.get()));
AudioOutputStream* aos = CreateDefaultAudioOutputStream(audio_manager.get());
EXPECT_TRUE(aos->Open());
@@ -265,7 +271,9 @@ TEST(WASAPIAudioOutputStreamTest, OpenAndClose) {
// Test Open(), Start(), Close() calling sequence.
TEST(WASAPIAudioOutputStreamTest, OpenStartAndClose) {
- scoped_ptr<AudioManager> audio_manager(AudioManager::CreateForTesting());
+ base::MessageLoop loop;
+ ScopedAudioManagerPtr audio_manager(
+ AudioManager::CreateForTesting(loop.task_runner()));
ABORT_AUDIO_TEST_IF_NOT(HasCoreAudioAndOutputDevices(audio_manager.get()));
AudioOutputStream* aos = CreateDefaultAudioOutputStream(audio_manager.get());
EXPECT_TRUE(aos->Open());
@@ -278,7 +286,9 @@ TEST(WASAPIAudioOutputStreamTest, OpenStartAndClose) {
// Test Open(), Start(), Stop(), Close() calling sequence.
TEST(WASAPIAudioOutputStreamTest, OpenStartStopAndClose) {
- scoped_ptr<AudioManager> audio_manager(AudioManager::CreateForTesting());
+ base::MessageLoop loop;
+ ScopedAudioManagerPtr audio_manager(
+ AudioManager::CreateForTesting(loop.task_runner()));
ABORT_AUDIO_TEST_IF_NOT(HasCoreAudioAndOutputDevices(audio_manager.get()));
AudioOutputStream* aos = CreateDefaultAudioOutputStream(audio_manager.get());
EXPECT_TRUE(aos->Open());
@@ -292,7 +302,9 @@ TEST(WASAPIAudioOutputStreamTest, OpenStartStopAndClose) {
// Test SetVolume(), GetVolume()
TEST(WASAPIAudioOutputStreamTest, Volume) {
- scoped_ptr<AudioManager> audio_manager(AudioManager::CreateForTesting());
+ base::MessageLoop loop;
+ ScopedAudioManagerPtr audio_manager(
+ AudioManager::CreateForTesting(loop.task_runner()));
ABORT_AUDIO_TEST_IF_NOT(HasCoreAudioAndOutputDevices(audio_manager.get()));
AudioOutputStream* aos = CreateDefaultAudioOutputStream(audio_manager.get());
@@ -328,7 +340,9 @@ TEST(WASAPIAudioOutputStreamTest, Volume) {
// Test some additional calling sequences.
TEST(WASAPIAudioOutputStreamTest, MiscCallingSequences) {
- scoped_ptr<AudioManager> audio_manager(AudioManager::CreateForTesting());
+ base::MessageLoop loop;
+ ScopedAudioManagerPtr audio_manager(
+ AudioManager::CreateForTesting(loop.task_runner()));
ABORT_AUDIO_TEST_IF_NOT(HasCoreAudioAndOutputDevices(audio_manager.get()));
AudioOutputStream* aos = CreateDefaultAudioOutputStream(audio_manager.get());
@@ -367,12 +381,12 @@ TEST(WASAPIAudioOutputStreamTest, MiscCallingSequences) {
// Use preferred packet size and verify that rendering starts.
TEST(WASAPIAudioOutputStreamTest, ValidPacketSize) {
- scoped_ptr<AudioManager> audio_manager(AudioManager::CreateForTesting());
+ base::MessageLoopForUI loop;
+ ScopedAudioManagerPtr audio_manager(
+ AudioManager::CreateForTesting(loop.task_runner()));
ABORT_AUDIO_TEST_IF_NOT(HasCoreAudioAndOutputDevices(audio_manager.get()));
- base::MessageLoopForUI loop;
MockAudioSourceCallback source;
-
// Create default WASAPI output stream which plays out in stereo using
// the shared mixing rate. The default buffer size is 10ms.
AudioOutputStreamWrapper aosw(audio_manager.get());
@@ -406,7 +420,9 @@ TEST(WASAPIAudioOutputStreamTest, ValidPacketSize) {
// environment variable to a value greater than 0.
// The test files are approximately 20 seconds long.
TEST(WASAPIAudioOutputStreamTest, DISABLED_ReadFromStereoFile) {
- scoped_ptr<AudioManager> audio_manager(AudioManager::CreateForTesting());
+ base::MessageLoop loop;
+ ScopedAudioManagerPtr audio_manager(
+ AudioManager::CreateForTesting(loop.task_runner()));
ABORT_AUDIO_TEST_IF_NOT(HasCoreAudioAndOutputDevices(audio_manager.get()));
AudioOutputStreamWrapper aosw(audio_manager.get());
@@ -456,7 +472,9 @@ TEST(WASAPIAudioOutputStreamTest, DISABLED_ReadFromStereoFile) {
// manually using log outputs (--v=1).
// It's disabled by default because a flag is required to enable exclusive mode.
TEST(WASAPIAudioOutputStreamTest, DISABLED_ExclusiveModeBufferSizesAt48kHz) {
- scoped_ptr<AudioManager> audio_manager(AudioManager::CreateForTesting());
+ base::MessageLoop loop;
+ ScopedAudioManagerPtr audio_manager(
+ AudioManager::CreateForTesting(loop.task_runner()));
ABORT_AUDIO_TEST_IF_NOT(HasCoreAudioAndOutputDevices(audio_manager.get()) &&
ExclusiveModeIsEnabled());
@@ -505,7 +523,9 @@ TEST(WASAPIAudioOutputStreamTest, DISABLED_ExclusiveModeBufferSizesAt48kHz) {
// manually using log outputs (--v=1).
// It's disabled by default because a flag is required to enable exclusive mode.
TEST(WASAPIAudioOutputStreamTest, DISABLED_ExclusiveModeBufferSizesAt44kHz) {
- scoped_ptr<AudioManager> audio_manager(AudioManager::CreateForTesting());
+ base::MessageLoop loop;
+ ScopedAudioManagerPtr audio_manager(
+ AudioManager::CreateForTesting(loop.task_runner()));
ABORT_AUDIO_TEST_IF_NOT(HasCoreAudioAndOutputDevices(audio_manager.get()) &&
ExclusiveModeIsEnabled());
@@ -561,13 +581,13 @@ TEST(WASAPIAudioOutputStreamTest, DISABLED_ExclusiveModeBufferSizesAt44kHz) {
// the lowest possible delay at 48kHz.
// It's disabled by default because a flag is required to enable exclusive mode.
TEST(WASAPIAudioOutputStreamTest, DISABLED_ExclusiveModeMinBufferSizeAt48kHz) {
- scoped_ptr<AudioManager> audio_manager(AudioManager::CreateForTesting());
+ base::MessageLoopForUI loop;
+ ScopedAudioManagerPtr audio_manager(
+ AudioManager::CreateForTesting(loop.task_runner()));
ABORT_AUDIO_TEST_IF_NOT(HasCoreAudioAndOutputDevices(audio_manager.get()) &&
ExclusiveModeIsEnabled());
- base::MessageLoopForUI loop;
MockAudioSourceCallback source;
-
// Create exclusive-mode WASAPI output stream which plays out in stereo
// using the minimum buffer size at 48kHz sample rate.
AudioOutputStreamWrapper aosw(audio_manager.get());
@@ -597,11 +617,11 @@ TEST(WASAPIAudioOutputStreamTest, DISABLED_ExclusiveModeMinBufferSizeAt48kHz) {
// It's disabled by default because a flag is required to enable exclusive mode.
TEST(WASAPIAudioOutputStreamTest, DISABLED_ExclusiveModeMinBufferSizeAt44kHz) {
ABORT_AUDIO_TEST_IF_NOT(ExclusiveModeIsEnabled());
- scoped_ptr<AudioManager> audio_manager(AudioManager::CreateForTesting());
-
base::MessageLoopForUI loop;
- MockAudioSourceCallback source;
+ ScopedAudioManagerPtr audio_manager(
+ AudioManager::CreateForTesting(loop.task_runner()));
+ MockAudioSourceCallback source;
// Create exclusive-mode WASAPI output stream which plays out in stereo
// using the minimum buffer size at 44.1kHz sample rate.
AudioOutputStreamWrapper aosw(audio_manager.get());

Powered by Google App Engine
This is Rietveld 408576698