From 540ddbbc036e706a3c038418eba364a3422e835b Mon Sep 17 00:00:00 2001 From: "cpu@google.com" Date: Mon, 19 Jan 2009 23:54:04 +0000 Subject: Do not runsome PCM audio tests on the bots - They are flaky when somebody RDPs into the bots. The system somehow installs an audio device on the fly that goes bad. - I think this is the issue as well on the trybots TBR=nsylvain Review URL: http://codereview.chromium.org/18197 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8272 0039d316-1c4b-4281-b951-d872f2087c98 --- media/audio/win/audio_output_win_unittest.cc | 24 ++++++++++++++++++++++++ media/audio/win/waveout_output_win.cc | 4 +--- 2 files changed, 25 insertions(+), 3 deletions(-) (limited to 'media') diff --git a/media/audio/win/audio_output_win_unittest.cc b/media/audio/win/audio_output_win_unittest.cc index 7635420..25dd7e6 100644 --- a/media/audio/win/audio_output_win_unittest.cc +++ b/media/audio/win/audio_output_win_unittest.cc @@ -10,6 +10,8 @@ #include "media/audio/simple_sources.h" #include "testing/gtest/include/gtest/gtest.h" +namespace { + // This class allows to find out if the callbacks are occurring as // expected and if any error has been reported. class TestSourceBasic : public AudioOutputStream::AudioSourceCallback { @@ -65,6 +67,13 @@ class TestSourceBasic : public AudioOutputStream::AudioSourceCallback { int was_closed_; }; +bool IsRunningHeadless() { + return (0 != ::GetEnvironmentVariableW(L"CHROME_HEADLESS", NULL, 0)); +} + +} // namespace. + + // Specializes TestSourceBasic to detect that the AudioStream is using // double buffering correctly. class TestSourceDoubleBuffer : public TestSourceBasic { @@ -165,9 +174,16 @@ TEST(WinAudioTest, SineWaveAudio16MonoTest) { // =========================================================================== // 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. // Test that can it be created and closed. TEST(WinAudioTest, PCMWaveStreamGetAndClose) { + if (IsRunningHeadless()) + return; AudioManager* audio_man = AudioManager::GetAudioManager(); ASSERT_TRUE(NULL != audio_man); if (!audio_man->HasAudioDevices()) @@ -180,6 +196,8 @@ TEST(WinAudioTest, PCMWaveStreamGetAndClose) { // Test that it can be opened and closed. TEST(WinAudioTest, PCMWaveStreamOpenAndClose) { + if (IsRunningHeadless()) + return; AudioManager* audio_man = AudioManager::GetAudioManager(); ASSERT_TRUE(NULL != audio_man); if (!audio_man->HasAudioDevices()) @@ -194,6 +212,8 @@ TEST(WinAudioTest, PCMWaveStreamOpenAndClose) { // Test that it uses the double buffers correctly. Because it uses the actual // audio device, you might hear a short pop noise for a short time. TEST(WinAudioTest, PCMWaveStreamDoubleBuffer) { + if (IsRunningHeadless()) + return; AudioManager* audio_man = AudioManager::GetAudioManager(); ASSERT_TRUE(NULL != audio_man); if (!audio_man->HasAudioDevices()) @@ -216,6 +236,8 @@ TEST(WinAudioTest, PCMWaveStreamDoubleBuffer) { // 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; AudioManager* audio_man = AudioManager::GetAudioManager(); ASSERT_TRUE(NULL != audio_man); if (!audio_man->HasAudioDevices()) @@ -240,6 +262,8 @@ TEST(WinAudioTest, PCMWaveStreamPlay200HzTone44Kss) { // device at 22K s/sec. Parameters have been chosen carefully so you should // not hear pops or noises while the sound is playing. TEST(WinAudioTest, PCMWaveStreamPlay200HzTone22Kss) { + if (IsRunningHeadless()) + return; AudioManager* audio_man = AudioManager::GetAudioManager(); ASSERT_TRUE(NULL != audio_man); if (!audio_man->HasAudioDevices()) diff --git a/media/audio/win/waveout_output_win.cc b/media/audio/win/waveout_output_win.cc index dbacad0..fa84884 100644 --- a/media/audio/win/waveout_output_win.cc +++ b/media/audio/win/waveout_output_win.cc @@ -77,10 +77,8 @@ bool PCMWaveOutAudioOutputStream::Open(size_t buffer_size) { reinterpret_cast(WaveCallback), reinterpret_cast(this), CALLBACK_FUNCTION); - if (result != MMSYSERR_NOERROR) { - fprintf(stderr, "waveOutOpen error %d\n", result); + if (result != MMSYSERR_NOERROR) return false; - } // If we don't have a packet size we use 100ms. if (!buffer_size) buffer_size = format_.nAvgBytesPerSec / 10; -- cgit v1.1