| Index: media/audio/win/audio_output_win_unittest.cc
|
| diff --git a/media/audio/win/audio_output_win_unittest.cc b/media/audio/win/audio_output_win_unittest.cc
|
| index 0c59d9b32b3fa1b93e9c2870e5edf1e77d160d4a..8e919ad05a019e70684625a20a54d5a39b203a2a 100644
|
| --- a/media/audio/win/audio_output_win_unittest.cc
|
| +++ b/media/audio/win/audio_output_win_unittest.cc
|
| @@ -9,6 +9,7 @@
|
|
|
| #include "base/base_paths.h"
|
| #include "base/memory/aligned_memory.h"
|
| +#include "base/message_loop/message_loop.h"
|
| #include "base/sync_socket.h"
|
| #include "base/win/scoped_com_initializer.h"
|
| #include "base/win/windows_version.h"
|
| @@ -153,7 +154,9 @@ class ReadOnlyMappedFile {
|
|
|
| // Test that can it be created and closed.
|
| TEST(WinAudioTest, PCMWaveStreamGetAndClose) {
|
| - scoped_ptr<AudioManager> audio_man(AudioManager::CreateForTesting());
|
| + base::MessageLoop loop;
|
| + ScopedAudioManagerPtr audio_man(
|
| + AudioManager::CreateForTesting(loop.task_runner()));
|
| ABORT_AUDIO_TEST_IF_NOT(audio_man->HasAudioOutputDevices());
|
|
|
| AudioOutputStream* oas = audio_man->MakeAudioOutputStream(
|
| @@ -166,7 +169,9 @@ TEST(WinAudioTest, PCMWaveStreamGetAndClose) {
|
|
|
| // Test that can it be cannot be created with invalid parameters.
|
| TEST(WinAudioTest, SanityOnMakeParams) {
|
| - scoped_ptr<AudioManager> audio_man(AudioManager::CreateForTesting());
|
| + base::MessageLoop loop;
|
| + ScopedAudioManagerPtr audio_man(
|
| + AudioManager::CreateForTesting(loop.task_runner()));
|
| ABORT_AUDIO_TEST_IF_NOT(audio_man->HasAudioOutputDevices());
|
|
|
| AudioParameters::Format fmt = AudioParameters::AUDIO_PCM_LINEAR;
|
| @@ -199,7 +204,9 @@ TEST(WinAudioTest, SanityOnMakeParams) {
|
|
|
| // Test that it can be opened and closed.
|
| TEST(WinAudioTest, PCMWaveStreamOpenAndClose) {
|
| - scoped_ptr<AudioManager> audio_man(AudioManager::CreateForTesting());
|
| + base::MessageLoop loop;
|
| + ScopedAudioManagerPtr audio_man(
|
| + AudioManager::CreateForTesting(loop.task_runner()));
|
| ABORT_AUDIO_TEST_IF_NOT(audio_man->HasAudioOutputDevices());
|
|
|
| AudioOutputStream* oas = audio_man->MakeAudioOutputStream(
|
| @@ -213,7 +220,9 @@ TEST(WinAudioTest, PCMWaveStreamOpenAndClose) {
|
|
|
| // Test that it has a maximum packet size.
|
| TEST(WinAudioTest, PCMWaveStreamOpenLimit) {
|
| - scoped_ptr<AudioManager> audio_man(AudioManager::CreateForTesting());
|
| + base::MessageLoop loop;
|
| + ScopedAudioManagerPtr audio_man(
|
| + AudioManager::CreateForTesting(loop.task_runner()));
|
| ABORT_AUDIO_TEST_IF_NOT(audio_man->HasAudioOutputDevices());
|
|
|
| AudioOutputStream* oas = audio_man->MakeAudioOutputStream(
|
| @@ -229,7 +238,9 @@ TEST(WinAudioTest, PCMWaveStreamOpenLimit) {
|
| // time. The actual EXPECT_GT are mostly meaningless and the real test is that
|
| // the test completes in reasonable time.
|
| TEST(WinAudioTest, PCMWaveSlowSource) {
|
| - scoped_ptr<AudioManager> audio_man(AudioManager::CreateForTesting());
|
| + base::MessageLoop loop;
|
| + ScopedAudioManagerPtr audio_man(
|
| + AudioManager::CreateForTesting(loop.task_runner()));
|
| ABORT_AUDIO_TEST_IF_NOT(audio_man->HasAudioOutputDevices());
|
|
|
| AudioOutputStream* oas = audio_man->MakeAudioOutputStream(
|
| @@ -254,7 +265,9 @@ TEST(WinAudioTest, PCMWaveSlowSource) {
|
| // gets paused. This test is best when run over RDP with audio enabled. See
|
| // bug 19276 for more details.
|
| TEST(WinAudioTest, PCMWaveStreamPlaySlowLoop) {
|
| - scoped_ptr<AudioManager> audio_man(AudioManager::CreateForTesting());
|
| + base::MessageLoop loop;
|
| + ScopedAudioManagerPtr audio_man(
|
| + AudioManager::CreateForTesting(loop.task_runner()));
|
| ABORT_AUDIO_TEST_IF_NOT(audio_man->HasAudioOutputDevices());
|
|
|
| uint32_t samples_100_ms = AudioParameters::kAudioCDSampleRate / 10;
|
| @@ -282,7 +295,9 @@ TEST(WinAudioTest, PCMWaveStreamPlaySlowLoop) {
|
| // device at 44.1K s/sec. Parameters have been chosen carefully so you should
|
| // not hear pops or noises while the sound is playing.
|
| TEST(WinAudioTest, PCMWaveStreamPlay200HzTone44Kss) {
|
| - scoped_ptr<AudioManager> audio_man(AudioManager::CreateForTesting());
|
| + base::MessageLoop loop;
|
| + ScopedAudioManagerPtr audio_man(
|
| + AudioManager::CreateForTesting(loop.task_runner()));
|
| if (!audio_man->HasAudioOutputDevices()) {
|
| LOG(WARNING) << "No output device detected.";
|
| return;
|
| @@ -310,7 +325,9 @@ TEST(WinAudioTest, PCMWaveStreamPlay200HzTone44Kss) {
|
| // not hear pops or noises while the sound is playing. The audio also should
|
| // sound with a lower volume than PCMWaveStreamPlay200HzTone44Kss.
|
| TEST(WinAudioTest, PCMWaveStreamPlay200HzTone22Kss) {
|
| - scoped_ptr<AudioManager> audio_man(AudioManager::CreateForTesting());
|
| + base::MessageLoop loop;
|
| + ScopedAudioManagerPtr audio_man(
|
| + AudioManager::CreateForTesting(loop.task_runner()));
|
| ABORT_AUDIO_TEST_IF_NOT(audio_man->HasAudioOutputDevices());
|
|
|
| uint32_t samples_100_ms = AudioParameters::kAudioCDSampleRate / 20;
|
| @@ -342,7 +359,9 @@ TEST(WinAudioTest, PCMWaveStreamPlay200HzTone22Kss) {
|
| // try hard to generate situation where the two threads are accessing the
|
| // object roughly at the same time.
|
| TEST(WinAudioTest, PushSourceFile16KHz) {
|
| - scoped_ptr<AudioManager> audio_man(AudioManager::CreateForTesting());
|
| + base::MessageLoop loop;
|
| + ScopedAudioManagerPtr audio_man(
|
| + AudioManager::CreateForTesting(loop.task_runner()));
|
| ABORT_AUDIO_TEST_IF_NOT(audio_man->HasAudioOutputDevices());
|
|
|
| static const int kSampleRate = 16000;
|
| @@ -382,7 +401,9 @@ TEST(WinAudioTest, PushSourceFile16KHz) {
|
| // stopped. You will here two .5 seconds wave signal separated by 0.5 seconds
|
| // of silence.
|
| TEST(WinAudioTest, PCMWaveStreamPlayTwice200HzTone44Kss) {
|
| - scoped_ptr<AudioManager> audio_man(AudioManager::CreateForTesting());
|
| + base::MessageLoop loop;
|
| + ScopedAudioManagerPtr audio_man(
|
| + AudioManager::CreateForTesting(loop.task_runner()));
|
| ABORT_AUDIO_TEST_IF_NOT(audio_man->HasAudioOutputDevices());
|
|
|
| uint32_t samples_100_ms = AudioParameters::kAudioCDSampleRate / 10;
|
| @@ -416,7 +437,9 @@ TEST(WinAudioTest, PCMWaveStreamPlayTwice200HzTone44Kss) {
|
| // higher and Wave is used for XP and lower. It is possible to utilize a
|
| // smaller buffer size for WASAPI than for Wave.
|
| TEST(WinAudioTest, PCMWaveStreamPlay200HzToneLowLatency) {
|
| - scoped_ptr<AudioManager> audio_man(AudioManager::CreateForTesting());
|
| + base::MessageLoop loop;
|
| + ScopedAudioManagerPtr audio_man(
|
| + AudioManager::CreateForTesting(loop.task_runner()));
|
| ABORT_AUDIO_TEST_IF_NOT(audio_man->HasAudioOutputDevices());
|
|
|
| // Use 10 ms buffer size for WASAPI and 50 ms buffer size for Wave.
|
| @@ -454,7 +477,9 @@ TEST(WinAudioTest, PCMWaveStreamPlay200HzToneLowLatency) {
|
|
|
| // Check that the pending bytes value is correct what the stream starts.
|
| TEST(WinAudioTest, PCMWaveStreamPendingBytes) {
|
| - scoped_ptr<AudioManager> audio_man(AudioManager::CreateForTesting());
|
| + base::MessageLoop loop;
|
| + ScopedAudioManagerPtr audio_man(
|
| + AudioManager::CreateForTesting(loop.task_runner()));
|
| ABORT_AUDIO_TEST_IF_NOT(audio_man->HasAudioOutputDevices());
|
|
|
| uint32_t samples_100_ms = AudioParameters::kAudioCDSampleRate / 10;
|
| @@ -586,7 +611,9 @@ DWORD __stdcall SyncSocketThread(void* context) {
|
| // related to the two different audio-layers for AUDIO_PCM_LOW_LATENCY.
|
| // In this test you should hear a continuous 200Hz tone for 2 seconds.
|
| TEST(WinAudioTest, SyncSocketBasic) {
|
| - scoped_ptr<AudioManager> audio_man(AudioManager::CreateForTesting());
|
| + base::MessageLoop loop;
|
| + ScopedAudioManagerPtr audio_man(
|
| + AudioManager::CreateForTesting(loop.task_runner()));
|
| ABORT_AUDIO_TEST_IF_NOT(audio_man->HasAudioOutputDevices());
|
|
|
| static const int sample_rate = AudioParameters::kAudioCDSampleRate;
|
|
|