diff options
author | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-13 13:51:31 +0000 |
---|---|---|
committer | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-13 13:51:31 +0000 |
commit | 949024149570551a332b15546c0129e048943121 (patch) | |
tree | a4f680a4906b1f9bc5c1129f17ade906aade4ffd /media | |
parent | 6b46031bc0d3071f6fdbd2c42ee8916454997662 (diff) | |
download | chromium_src-949024149570551a332b15546c0129e048943121.zip chromium_src-949024149570551a332b15546c0129e048943121.tar.gz chromium_src-949024149570551a332b15546c0129e048943121.tar.bz2 |
Remove the headless check for the audio output unittests.
Presence of hardware should still be correctly detected and the tests should not fail on machines without the required hardware.
This is in anticipation of getting our audio equipped build bots and to enable the tests on the already capable mac bots.
TEST=run media_unittests on the build bots.
Review URL: http://codereview.chromium.org/9005008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117639 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/audio/mac/audio_output_mac_unittest.cc | 4 | ||||
-rw-r--r-- | media/audio/win/audio_output_win_unittest.cc | 112 |
2 files changed, 59 insertions, 57 deletions
diff --git a/media/audio/mac/audio_output_mac_unittest.cc b/media/audio/mac/audio_output_mac_unittest.cc index f15ab69..76f15a9 100644 --- a/media/audio/mac/audio_output_mac_unittest.cc +++ b/media/audio/mac/audio_output_mac_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -48,8 +48,6 @@ TEST(MacAudioTest, SineWaveAudio16MonoTest) { // =========================================================================== // Validation of AudioParameters::AUDIO_PCM_LINEAR // -// Unlike windows, the tests can reliably detect the existence of real -// audio devices on the bots thus no need for 'headless' detection. // Test that can it be created and closed. TEST(MacAudioTest, PCMWaveStreamGetAndClose) { diff --git a/media/audio/win/audio_output_win_unittest.cc b/media/audio/win/audio_output_win_unittest.cc index 72f078a..4d5a13c 100644 --- a/media/audio/win/audio_output_win_unittest.cc +++ b/media/audio/win/audio_output_win_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -73,10 +73,6 @@ class TestSourceBasic : public AudioOutputStream::AudioSourceCallback { int had_error_; }; -static bool IsRunningHeadless() { - return (0 != ::GetEnvironmentVariableW(L"CHROME_HEADLESS", NULL, 0)); -} - const int kNumBuffers = 3; // Specializes TestSourceBasic to detect that the AudioStream is using // triple buffering correctly. @@ -216,18 +212,19 @@ TEST(WinAudioTest, MockStreamBasicCallbacks) { // =========================================================================== // Validation of AudioManager::AUDIO_PCM_LINEAR // -// The tests tend to fail in the build bots when somebody connects to them via -// via remote-desktop because it installs an audio device that fails to open -// at some point, possibly when the connection goes idle. So that is why we -// skipped them in headless mode. +// NOTE: +// The tests can fail on the build bots when somebody connects to them via +// remote-desktop and the rdp client installs an audio device that fails to open +// at some point, possibly when the connection goes idle. // Test that can it be created and closed. TEST(WinAudioTest, PCMWaveStreamGetAndClose) { - if (IsRunningHeadless()) - return; scoped_refptr<AudioManager> audio_man(AudioManager::Create()); - if (!audio_man->HasAudioOutputDevices()) + if (!audio_man->HasAudioOutputDevices()) { + LOG(WARNING) << "No output device detected."; return; + } + AudioOutputStream* oas = audio_man->MakeAudioOutputStream( AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_STEREO, 8000, 16, 256)); @@ -237,11 +234,12 @@ TEST(WinAudioTest, PCMWaveStreamGetAndClose) { // Test that can it be cannot be created with invalid parameters. TEST(WinAudioTest, SanityOnMakeParams) { - if (IsRunningHeadless()) - return; scoped_refptr<AudioManager> audio_man(AudioManager::Create()); - if (!audio_man->HasAudioOutputDevices()) + if (!audio_man->HasAudioOutputDevices()) { + LOG(WARNING) << "No output device detected."; return; + } + AudioParameters::Format fmt = AudioParameters::AUDIO_PCM_LINEAR; EXPECT_TRUE(NULL == audio_man->MakeAudioOutputStream( AudioParameters(fmt, CHANNEL_LAYOUT_UNSUPPORTED, 8000, 16, 256))); @@ -264,11 +262,12 @@ TEST(WinAudioTest, SanityOnMakeParams) { // Test that it can be opened and closed. TEST(WinAudioTest, PCMWaveStreamOpenAndClose) { - if (IsRunningHeadless()) - return; scoped_refptr<AudioManager> audio_man(AudioManager::Create()); - if (!audio_man->HasAudioOutputDevices()) + if (!audio_man->HasAudioOutputDevices()) { + LOG(WARNING) << "No output device detected."; return; + } + AudioOutputStream* oas = audio_man->MakeAudioOutputStream( AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_STEREO, 8000, 16, 256)); @@ -279,11 +278,12 @@ TEST(WinAudioTest, PCMWaveStreamOpenAndClose) { // Test that it has a maximum packet size. TEST(WinAudioTest, PCMWaveStreamOpenLimit) { - if (IsRunningHeadless()) - return; scoped_refptr<AudioManager> audio_man(AudioManager::Create()); - if (!audio_man->HasAudioOutputDevices()) + if (!audio_man->HasAudioOutputDevices()) { + LOG(WARNING) << "No output device detected."; return; + } + AudioOutputStream* oas = audio_man->MakeAudioOutputStream( AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_STEREO, 8000, 16, 1024 * 1024 * 1024)); @@ -295,11 +295,12 @@ TEST(WinAudioTest, PCMWaveStreamOpenLimit) { // Test that it uses the triple buffers correctly. Because it uses the actual // audio device, you might hear a short pop noise for a short time. TEST(WinAudioTest, PCMWaveStreamTripleBuffer) { - if (IsRunningHeadless()) - return; scoped_refptr<AudioManager> audio_man(AudioManager::Create()); - if (!audio_man->HasAudioOutputDevices()) + if (!audio_man->HasAudioOutputDevices()) { + LOG(WARNING) << "No output device detected."; return; + } + AudioOutputStream* oas = audio_man->MakeAudioOutputStream( AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO, 16000, 16, 256)); @@ -319,11 +320,12 @@ TEST(WinAudioTest, PCMWaveStreamTripleBuffer) { // time. The actual EXPECT_GT are mostly meaningless and the real test is that // the test completes in reasonable time. TEST(WinAudioTest, PCMWaveSlowSource) { - if (IsRunningHeadless()) - return; scoped_refptr<AudioManager> audio_man(AudioManager::Create()); - if (!audio_man->HasAudioOutputDevices()) + if (!audio_man->HasAudioOutputDevices()) { + LOG(WARNING) << "No output device detected."; return; + } + AudioOutputStream* oas = audio_man->MakeAudioOutputStream( AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO, 16000, 16, 256)); @@ -345,11 +347,12 @@ 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) { - if (IsRunningHeadless()) - return; scoped_refptr<AudioManager> audio_man(AudioManager::Create()); - if (!audio_man->HasAudioOutputDevices()) + if (!audio_man->HasAudioOutputDevices()) { + LOG(WARNING) << "No output device detected."; return; + } + uint32 samples_100_ms = AudioParameters::kAudioCDSampleRate / 10; AudioOutputStream* oas = audio_man->MakeAudioOutputStream( AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO, @@ -375,11 +378,12 @@ 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) { - if (IsRunningHeadless()) - return; scoped_refptr<AudioManager> audio_man(AudioManager::Create()); - if (!audio_man->HasAudioOutputDevices()) + if (!audio_man->HasAudioOutputDevices()) { + LOG(WARNING) << "No output device detected."; return; + } + uint32 samples_100_ms = AudioParameters::kAudioCDSampleRate / 10; AudioOutputStream* oas = audio_man->MakeAudioOutputStream( AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO, @@ -402,11 +406,12 @@ 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) { - if (IsRunningHeadless()) - return; scoped_refptr<AudioManager> audio_man(AudioManager::Create()); - if (!audio_man->HasAudioOutputDevices()) + if (!audio_man->HasAudioOutputDevices()) { + LOG(WARNING) << "No output device detected."; return; + } + uint32 samples_100_ms = AudioParameters::kAudioCDSampleRate / 20; AudioOutputStream* oas = audio_man->MakeAudioOutputStream( AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO, @@ -438,8 +443,12 @@ TEST(WinAudioTest, PCMWaveStreamPlay200HzTone22Kss) { // to 2KHz with a bit of fade out at the end for one second. The file is two // of these sweeping tones back to back. TEST(WinAudioTest, PushSourceFile16KHz) { - if (IsRunningHeadless()) + scoped_refptr<AudioManager> audio_man(AudioManager::Create()); + if (!audio_man->HasAudioOutputDevices()) { + LOG(WARNING) << "No output device detected."; return; + } + // Open sweep02_16b_mono_16KHz.raw which has no format. It contains the // raw 16 bit samples for a single channel in little-endian format. The // creation sample rate is 16KHz. @@ -450,10 +459,6 @@ TEST(WinAudioTest, PushSourceFile16KHz) { ReadOnlyMappedFile file_reader(audio_file.value().c_str()); ASSERT_TRUE(file_reader.is_valid()); - scoped_refptr<AudioManager> audio_man(AudioManager::Create()); - if (!audio_man->HasAudioOutputDevices()) - return; - // Compute buffer size for 100ms of audio. const uint32 kSamples100ms = (16000 / 1000) * 100; const uint32 kSize100ms = kSamples100ms * 2; @@ -495,11 +500,11 @@ TEST(WinAudioTest, PushSourceFile16KHz) { // stopped. You will here two .5 seconds wave signal separated by 0.5 seconds // of silence. TEST(WinAudioTest, PCMWaveStreamPlayTwice200HzTone44Kss) { - if (IsRunningHeadless()) - return; scoped_refptr<AudioManager> audio_man(AudioManager::Create()); - if (!audio_man->HasAudioOutputDevices()) + if (!audio_man->HasAudioOutputDevices()) { + LOG(WARNING) << "No output device detected."; return; + } uint32 samples_100_ms = AudioParameters::kAudioCDSampleRate / 10; AudioOutputStream* oas = audio_man->MakeAudioOutputStream( @@ -532,11 +537,11 @@ 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) { - if (IsRunningHeadless()) - return; scoped_refptr<AudioManager> audio_man(AudioManager::Create()); - if (!audio_man->HasAudioOutputDevices()) + if (!audio_man->HasAudioOutputDevices()) { + LOG(WARNING) << "No output device detected."; return; + } // The WASAPI API requires a correct COM environment. ScopedCOMInitializer com_init(ScopedCOMInitializer::kMTA); @@ -568,11 +573,11 @@ TEST(WinAudioTest, PCMWaveStreamPlay200HzToneLowLatency) { // Check that the pending bytes value is correct what the stream starts. TEST(WinAudioTest, PCMWaveStreamPendingBytes) { - if (IsRunningHeadless()) - return; scoped_refptr<AudioManager> audio_man(AudioManager::Create()); - if (!audio_man->HasAudioOutputDevices()) + if (!audio_man->HasAudioOutputDevices()) { + LOG(WARNING) << "No output device detected."; return; + } uint32 samples_100_ms = AudioParameters::kAudioCDSampleRate / 10; AudioOutputStream* oas = audio_man->MakeAudioOutputStream( @@ -696,12 +701,11 @@ 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) { - if (IsRunningHeadless()) - return; - scoped_refptr<AudioManager> audio_man(AudioManager::Create()); - if (!audio_man->HasAudioOutputDevices()) + if (!audio_man->HasAudioOutputDevices()) { + LOG(WARNING) << "No output device detected."; return; + } int sample_rate = AudioParameters::kAudioCDSampleRate; const uint32 kSamples20ms = sample_rate / 50; |