summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorcpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-14 23:06:30 +0000
committercpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-14 23:06:30 +0000
commit5c08aa3da8685d351000f8aab52b2ae2b1ab8714 (patch)
tree6f44439f67812111277079eddc105f0b424f1d95 /media
parent3f5d201c12cc91dbd009388b5f021e149fa1036c (diff)
downloadchromium_src-5c08aa3da8685d351000f8aab52b2ae2b1ab8714.zip
chromium_src-5c08aa3da8685d351000f8aab52b2ae2b1ab8714.tar.gz
chromium_src-5c08aa3da8685d351000f8aab52b2ae2b1ab8714.tar.bz2
Re-enable the audio tests that fail in the bots
- Basically skip some tests if the OS reports there is no audio device. Review URL: http://codereview.chromium.org/16811 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8047 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/audio/audio_output.h4
-rw-r--r--media/audio/win/audio_manager_win.h1
-rw-r--r--media/audio/win/audio_output_win.cc5
-rw-r--r--media/audio/win/audio_output_win_unittest.cc18
4 files changed, 24 insertions, 4 deletions
diff --git a/media/audio/audio_output.h b/media/audio/audio_output.h
index 37235a2..b21d653 100644
--- a/media/audio/audio_output.h
+++ b/media/audio/audio_output.h
@@ -114,6 +114,10 @@ class AudioManager {
// Digital Audio Tape sample rate.
static const int kAudioDATSampleRate = 48000;
+ // Returns true if the OS reports existence of audio devices. This does not
+ // guarantee that the existing devices support all formats and sample rates.
+ virtual bool HasAudioDevices() = 0;
+
// Factory for all the supported stream formats. At this moment |channels|
// can be 1 (mono) or 2 (stereo). The |sample_rate| is in hertz and can be
// any value supported by the underlying platform. For some future formats
diff --git a/media/audio/win/audio_manager_win.h b/media/audio/win/audio_manager_win.h
index df9e076..05040ce 100644
--- a/media/audio/win/audio_manager_win.h
+++ b/media/audio/win/audio_manager_win.h
@@ -20,6 +20,7 @@ class AudioManagerWin : public AudioManager {
public:
AudioManagerWin() {}
// Implementation of AudioManager.
+ virtual bool HasAudioDevices();
virtual AudioOutputStream* MakeAudioStream(Format format, int channels,
int sample_rate,
char bits_per_sample);
diff --git a/media/audio/win/audio_output_win.cc b/media/audio/win/audio_output_win.cc
index 5685ee7..6003fcd 100644
--- a/media/audio/win/audio_output_win.cc
+++ b/media/audio/win/audio_output_win.cc
@@ -89,6 +89,11 @@ void ReplaceLastMockStream(AudioOutputStreamMockWin* newer) {
} // namespace.
+
+bool AudioManagerWin::HasAudioDevices() {
+ return (::waveOutGetNumDevs() != 0);
+}
+
// Factory for the implementations of AudioOutputStream. Two implementations
// should suffice most windows user's needs.
// - PCMWaveOutAudioOutputStream: Based on the waveOutWrite API (in progress)
diff --git a/media/audio/win/audio_output_win_unittest.cc b/media/audio/win/audio_output_win_unittest.cc
index 1780630..7635420 100644
--- a/media/audio/win/audio_output_win_unittest.cc
+++ b/media/audio/win/audio_output_win_unittest.cc
@@ -170,6 +170,8 @@ TEST(WinAudioTest, SineWaveAudio16MonoTest) {
TEST(WinAudioTest, PCMWaveStreamGetAndClose) {
AudioManager* audio_man = AudioManager::GetAudioManager();
ASSERT_TRUE(NULL != audio_man);
+ if (!audio_man->HasAudioDevices())
+ return;
AudioOutputStream* oas =
audio_man->MakeAudioStream(AudioManager::AUDIO_PCM_LINEAR, 2, 8000, 16);
ASSERT_TRUE(NULL != oas);
@@ -177,9 +179,11 @@ TEST(WinAudioTest, PCMWaveStreamGetAndClose) {
}
// Test that it can be opened and closed.
-TEST(WinAudioTest, DISABLED_PCMWaveStreamOpenAndClose) {
+TEST(WinAudioTest, PCMWaveStreamOpenAndClose) {
AudioManager* audio_man = AudioManager::GetAudioManager();
ASSERT_TRUE(NULL != audio_man);
+ if (!audio_man->HasAudioDevices())
+ return;
AudioOutputStream* oas =
audio_man->MakeAudioStream(AudioManager::AUDIO_PCM_LINEAR, 2, 8000, 16);
ASSERT_TRUE(NULL != oas);
@@ -189,9 +193,11 @@ TEST(WinAudioTest, DISABLED_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, DISABLED_PCMWaveStreamDoubleBuffer) {
+TEST(WinAudioTest, PCMWaveStreamDoubleBuffer) {
AudioManager* audio_man = AudioManager::GetAudioManager();
ASSERT_TRUE(NULL != audio_man);
+ if (!audio_man->HasAudioDevices())
+ return;
AudioOutputStream* oas =
audio_man->MakeAudioStream(AudioManager::AUDIO_PCM_LINEAR, 1, 16000, 16);
ASSERT_TRUE(NULL != oas);
@@ -209,9 +215,11 @@ TEST(WinAudioTest, DISABLED_PCMWaveStreamDoubleBuffer) {
// This test produces actual audio for 1.5 seconds on the default wave
// 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, DISABLED_PCMWaveStreamPlay200HzTone44Kss) {
+TEST(WinAudioTest, PCMWaveStreamPlay200HzTone44Kss) {
AudioManager* audio_man = AudioManager::GetAudioManager();
ASSERT_TRUE(NULL != audio_man);
+ if (!audio_man->HasAudioDevices())
+ return;
AudioOutputStream* oas =
audio_man->MakeAudioStream(AudioManager::AUDIO_PCM_LINEAR, 1,
AudioManager::kAudioCDSampleRate, 16);
@@ -231,9 +239,11 @@ TEST(WinAudioTest, DISABLED_PCMWaveStreamPlay200HzTone44Kss) {
// This test produces actual audio for for 1.5 seconds on the default wave
// 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, DISABLED_PCMWaveStreamPlay200HzTone22Kss) {
+TEST(WinAudioTest, PCMWaveStreamPlay200HzTone22Kss) {
AudioManager* audio_man = AudioManager::GetAudioManager();
ASSERT_TRUE(NULL != audio_man);
+ if (!audio_man->HasAudioDevices())
+ return;
AudioOutputStream* oas =
audio_man->MakeAudioStream(AudioManager::AUDIO_PCM_LINEAR, 1,
AudioManager::kAudioCDSampleRate/2, 16);