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

Unified Diff: media/audio/audio_output_proxy_unittest.cc

Issue 12261027: Don't switch to fake audio output until stream open fails. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unittests. Created 7 years, 10 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/audio_output_proxy_unittest.cc
diff --git a/media/audio/audio_output_proxy_unittest.cc b/media/audio/audio_output_proxy_unittest.cc
index fc0cd2640760fbfcfd4e534bdcc62eeec79de134..9b1599a621a3d35035c038f2f66ed29d02b0ccfe 100644
--- a/media/audio/audio_output_proxy_unittest.cc
+++ b/media/audio/audio_output_proxy_unittest.cc
@@ -617,12 +617,42 @@ TEST_F(AudioOutputResamplerTest, LowLatencyOpenFailedFallback) {
}
// Simulate failures to open both the low latency and the fallback high latency
-// stream and ensure AudioOutputResampler terminates normally.
-TEST_F(AudioOutputResamplerTest, LowLatencyFallbackFailed) {
+// stream and ensure AudioOutputResampler falls back to a fake stream.
+TEST_F(AudioOutputResamplerTest, HighLatencyFallbackFailed) {
+ MockAudioOutputStream okay_stream(&manager_, params_);
+
EXPECT_CALL(manager(), MakeAudioOutputStream(_))
.Times(2)
.WillRepeatedly(Return(static_cast<AudioOutputStream*>(NULL)));
+ // To prevent shared memory issues the sample rate and buffer size should
+ // match the input stream parameters.
+ EXPECT_CALL(manager(), MakeAudioOutputStream(AllOf(
+ testing::Property(&AudioParameters::format, AudioParameters::AUDIO_FAKE),
+ testing::Property(&AudioParameters::sample_rate, params_.sample_rate()),
+ testing::Property(
+ &AudioParameters::frames_per_buffer, params_.frames_per_buffer()))))
+ .Times(1)
+ .WillOnce(Return(&okay_stream));
+ EXPECT_CALL(okay_stream, Open())
+ .WillOnce(Return(true));
+ EXPECT_CALL(okay_stream, Close())
+ .Times(1);
+
+ AudioOutputProxy* proxy = new AudioOutputProxy(resampler_);
+ EXPECT_TRUE(proxy->Open());
+ proxy->Close();
+ WaitForCloseTimer(kTestCloseDelayMs);
+}
+
+// Simulate failures to open both the low latency, the fallback high latency
+// stream, and the fake audio output stream and ensure AudioOutputResampler
+// terminates normally.
+TEST_F(AudioOutputResamplerTest, AllFallbackFailed) {
+ EXPECT_CALL(manager(), MakeAudioOutputStream(_))
+ .Times(3)
+ .WillRepeatedly(Return(static_cast<AudioOutputStream*>(NULL)));
+
AudioOutputProxy* proxy = new AudioOutputProxy(resampler_);
EXPECT_FALSE(proxy->Open());
proxy->Close();

Powered by Google App Engine
This is Rietveld 408576698