Chromium Code Reviews| 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 da0ead22087e78d4231e2db769f50e60bc6a7911..eef6f1fe13d4099d6e65f5b5a484ca668b66c059 100644 |
| --- a/media/audio/audio_output_proxy_unittest.cc |
| +++ b/media/audio/audio_output_proxy_unittest.cc |
| @@ -8,7 +8,7 @@ |
| #include "base/message_loop_proxy.h" |
| #include "base/threading/platform_thread.h" |
| #include "media/audio/audio_output_dispatcher_impl.h" |
| -#include "media/audio/audio_output_mixer.h" |
| +//#include "media/audio/audio_output_mixer.h" |
|
scherkus (not reviewing)
2012/08/09 22:12:39
ditto here + below for all the tests
DaleCurtis
2012/08/09 22:46:29
Done.
|
| #include "media/audio/audio_output_proxy.h" |
| #include "media/audio/audio_manager.h" |
| #include "testing/gmock/include/gmock/gmock.h" |
| @@ -105,7 +105,8 @@ class AudioOutputProxyTest : public testing::Test { |
| dispatcher_impl_ = new AudioOutputDispatcherImpl(&manager(), |
| params, |
| close_delay); |
| - mixer_ = new AudioOutputMixer(&manager(), params, close_delay); |
| + // TODO(dalecurtis): Temporarily disabled while switching over to floats. |
| + // mixer_ = new AudioOutputMixer(&manager(), params, close_delay); |
| // Necessary to know how long the dispatcher will wait before posting |
| // StopStreamTask. |
| @@ -240,7 +241,8 @@ class AudioOutputProxyTest : public testing::Test { |
| MessageLoop message_loop_; |
| scoped_refptr<AudioOutputDispatcherImpl> dispatcher_impl_; |
| - scoped_refptr<AudioOutputMixer> mixer_; |
| + // TODO(dalecurtis): Temporarily disabled while switching over to floats. |
| + // scoped_refptr<AudioOutputMixer> mixer_; |
| base::TimeDelta pause_delay_; |
| MockAudioManager manager_; |
| MockAudioSourceCallback callback_; |
| @@ -251,18 +253,20 @@ TEST_F(AudioOutputProxyTest, CreateAndClose) { |
| proxy->Close(); |
| } |
| -TEST_F(AudioOutputProxyTest, CreateAndClose_Mixer) { |
| - AudioOutputProxy* proxy = new AudioOutputProxy(mixer_); |
| - proxy->Close(); |
| -} |
| +// TODO(dalecurtis): Temporarily disabled while switching over to floats. |
| +// TEST_F(AudioOutputProxyTest, CreateAndClose_Mixer) { |
| +// AudioOutputProxy* proxy = new AudioOutputProxy(mixer_); |
| +// proxy->Close(); |
| +// } |
| TEST_F(AudioOutputProxyTest, OpenAndClose) { |
| OpenAndClose(dispatcher_impl_); |
| } |
| -TEST_F(AudioOutputProxyTest, OpenAndClose_Mixer) { |
| - OpenAndClose(mixer_); |
| -} |
| +// TODO(dalecurtis): Temporarily disabled while switching over to floats. |
| +// TEST_F(AudioOutputProxyTest, OpenAndClose_Mixer) { |
| +// OpenAndClose(mixer_); |
| +// } |
| // Create a stream, and verify that it is closed after kTestCloseDelayMs. |
| // if it doesn't start playing. |
| @@ -294,25 +298,28 @@ TEST_F(AudioOutputProxyTest, StartAndStop) { |
| StartAndStop(dispatcher_impl_); |
| } |
| -TEST_F(AudioOutputProxyTest, StartAndStop_Mixer) { |
| - StartAndStop(mixer_); |
| -} |
| +// TODO(dalecurtis): Temporarily disabled while switching over to floats. |
| +// TEST_F(AudioOutputProxyTest, StartAndStop_Mixer) { |
| +// StartAndStop(mixer_); |
| +// } |
| TEST_F(AudioOutputProxyTest, CloseAfterStop) { |
| CloseAfterStop(dispatcher_impl_); |
| } |
| -TEST_F(AudioOutputProxyTest, CloseAfterStop_Mixer) { |
| - CloseAfterStop(mixer_); |
| -} |
| +// TODO(dalecurtis): Temporarily disabled while switching over to floats. |
| +// TEST_F(AudioOutputProxyTest, CloseAfterStop_Mixer) { |
| +// CloseAfterStop(mixer_); |
| +// } |
| TEST_F(AudioOutputProxyTest, TwoStreams) { |
| TwoStreams(dispatcher_impl_); |
| } |
| -TEST_F(AudioOutputProxyTest, TwoStreams_Mixer) { |
| - TwoStreams(mixer_); |
| -} |
| +// TODO(dalecurtis): Temporarily disabled while switching over to floats. |
| +// TEST_F(AudioOutputProxyTest, TwoStreams_Mixer) { |
| +// TwoStreams(mixer_); |
| +// } |
| // Two streams: verify that second stream is allocated when the first |
| // starts playing. |
| @@ -355,38 +362,39 @@ TEST_F(AudioOutputProxyTest, TwoStreams_OnePlaying) { |
| proxy2->Close(); |
| } |
| -// Two streams: verify that only one device will be created. |
| -TEST_F(AudioOutputProxyTest, TwoStreams_OnePlaying_Mixer) { |
| - MockAudioOutputStream stream; |
| +// TODO(dalecurtis): Temporarily disabled while switching over to floats. |
| +// // Two streams: verify that only one device will be created. |
| +// TEST_F(AudioOutputProxyTest, TwoStreams_OnePlaying_Mixer) { |
| +// MockAudioOutputStream stream; |
| - InitDispatcher(base::TimeDelta::FromMilliseconds(kTestCloseDelayMs)); |
| +// InitDispatcher(base::TimeDelta::FromMilliseconds(kTestCloseDelayMs)); |
| - EXPECT_CALL(manager(), MakeAudioOutputStream(_)) |
| - .WillOnce(Return(&stream)); |
| +// EXPECT_CALL(manager(), MakeAudioOutputStream(_)) |
| +// .WillOnce(Return(&stream)); |
| - EXPECT_CALL(stream, Open()) |
| - .WillOnce(Return(true)); |
| - EXPECT_CALL(stream, Start(_)) |
| - .Times(1); |
| - EXPECT_CALL(stream, SetVolume(_)) |
| - .Times(1); |
| - EXPECT_CALL(stream, Stop()) |
| - .Times(1); |
| - EXPECT_CALL(stream, Close()) |
| - .Times(1); |
| +// EXPECT_CALL(stream, Open()) |
| +// .WillOnce(Return(true)); |
| +// EXPECT_CALL(stream, Start(_)) |
| +// .Times(1); |
| +// EXPECT_CALL(stream, SetVolume(_)) |
| +// .Times(1); |
| +// EXPECT_CALL(stream, Stop()) |
| +// .Times(1); |
| +// EXPECT_CALL(stream, Close()) |
| +// .Times(1); |
| - AudioOutputProxy* proxy1 = new AudioOutputProxy(mixer_); |
| - AudioOutputProxy* proxy2 = new AudioOutputProxy(mixer_); |
| - EXPECT_TRUE(proxy1->Open()); |
| - EXPECT_TRUE(proxy2->Open()); |
| +// AudioOutputProxy* proxy1 = new AudioOutputProxy(mixer_); |
| +// AudioOutputProxy* proxy2 = new AudioOutputProxy(mixer_); |
| +// EXPECT_TRUE(proxy1->Open()); |
| +// EXPECT_TRUE(proxy2->Open()); |
| - proxy1->Start(&callback_); |
| - proxy1->Stop(); |
| +// proxy1->Start(&callback_); |
| +// proxy1->Stop(); |
| - proxy1->Close(); |
| - proxy2->Close(); |
| - WaitForCloseTimer(kTestCloseDelayMs); |
| -} |
| +// proxy1->Close(); |
| +// proxy2->Close(); |
| +// WaitForCloseTimer(kTestCloseDelayMs); |
| +// } |
| // Two streams, both are playing. Dispatcher should not open a third stream. |
| TEST_F(AudioOutputProxyTest, TwoStreams_BothPlaying) { |
| @@ -435,76 +443,78 @@ TEST_F(AudioOutputProxyTest, TwoStreams_BothPlaying) { |
| proxy2->Close(); |
| } |
| -// Two streams, both are playing. Still have to use single device. |
| -// Also verifies that every proxy stream gets its own pending_bytes. |
| -TEST_F(AudioOutputProxyTest, TwoStreams_BothPlaying_Mixer) { |
| - MockAudioOutputStream stream; |
| - |
| - InitDispatcher(base::TimeDelta::FromMilliseconds(kTestCloseDelayMs)); |
| - |
| - EXPECT_CALL(manager(), MakeAudioOutputStream(_)) |
| - .WillOnce(Return(&stream)); |
| - |
| - EXPECT_CALL(stream, Open()) |
| - .WillOnce(Return(true)); |
| - EXPECT_CALL(stream, Start(_)) |
| - .Times(1); |
| - EXPECT_CALL(stream, SetVolume(_)) |
| - .Times(1); |
| - EXPECT_CALL(stream, Stop()) |
| - .Times(1); |
| - EXPECT_CALL(stream, Close()) |
| - .Times(1); |
| - |
| - AudioOutputProxy* proxy1 = new AudioOutputProxy(mixer_); |
| - AudioOutputProxy* proxy2 = new AudioOutputProxy(mixer_); |
| - EXPECT_TRUE(proxy1->Open()); |
| - EXPECT_TRUE(proxy2->Open()); |
| - |
| - proxy1->Start(&callback_); |
| - |
| - // Mute the proxy. Resulting stream should still have correct length. |
| - proxy1->SetVolume(0.0); |
| - |
| - uint8 zeroes[4] = {0, 0, 0, 0}; |
| - uint8 buf1[4] = {0}; |
| - EXPECT_CALL(callback_, |
| - OnMoreData(NotNull(), 4, |
| - AllOf(Field(&AudioBuffersState::pending_bytes, 0), |
| - Field(&AudioBuffersState::hardware_delay_bytes, 0)))) |
| - .WillOnce(DoAll(SetArrayArgument<0>(zeroes, zeroes + sizeof(zeroes)), |
| - Return(4))); |
| - mixer_->OnMoreData(buf1, sizeof(buf1), AudioBuffersState(0, 0)); |
| - proxy2->Start(&callback_); |
| - uint8 buf2[4] = {0}; |
| - EXPECT_CALL(callback_, |
| - OnMoreData(NotNull(), 4, |
| - AllOf(Field(&AudioBuffersState::pending_bytes, 4), |
| - Field(&AudioBuffersState::hardware_delay_bytes, 0)))) |
| - .WillOnce(DoAll(SetArrayArgument<0>(zeroes, zeroes + sizeof(zeroes)), |
| - Return(4))); |
| - EXPECT_CALL(callback_, |
| - OnMoreData(NotNull(), 4, |
| - AllOf(Field(&AudioBuffersState::pending_bytes, 0), |
| - Field(&AudioBuffersState::hardware_delay_bytes, 0)))) |
| - .WillOnce(DoAll(SetArrayArgument<0>(zeroes, zeroes + sizeof(zeroes)), |
| - Return(4))); |
| - mixer_->OnMoreData(buf2, sizeof(buf2), AudioBuffersState(4, 0)); |
| - proxy1->Stop(); |
| - proxy2->Stop(); |
| - |
| - proxy1->Close(); |
| - proxy2->Close(); |
| - WaitForCloseTimer(kTestCloseDelayMs); |
| -} |
| +// TODO(dalecurtis): Temporarily disabled while switching over to floats. |
| +// // Two streams, both are playing. Still have to use single device. |
| +// // Also verifies that every proxy stream gets its own pending_bytes. |
| +// TEST_F(AudioOutputProxyTest, TwoStreams_BothPlaying_Mixer) { |
| +// MockAudioOutputStream stream; |
| + |
| +// InitDispatcher(base::TimeDelta::FromMilliseconds(kTestCloseDelayMs)); |
| + |
| +// EXPECT_CALL(manager(), MakeAudioOutputStream(_)) |
| +// .WillOnce(Return(&stream)); |
| + |
| +// EXPECT_CALL(stream, Open()) |
| +// .WillOnce(Return(true)); |
| +// EXPECT_CALL(stream, Start(_)) |
| +// .Times(1); |
| +// EXPECT_CALL(stream, SetVolume(_)) |
| +// .Times(1); |
| +// EXPECT_CALL(stream, Stop()) |
| +// .Times(1); |
| +// EXPECT_CALL(stream, Close()) |
| +// .Times(1); |
| + |
| +// AudioOutputProxy* proxy1 = new AudioOutputProxy(mixer_); |
| +// AudioOutputProxy* proxy2 = new AudioOutputProxy(mixer_); |
| +// EXPECT_TRUE(proxy1->Open()); |
| +// EXPECT_TRUE(proxy2->Open()); |
| + |
| +// proxy1->Start(&callback_); |
| + |
| +// // Mute the proxy. Resulting stream should still have correct length. |
| +// proxy1->SetVolume(0.0); |
| + |
| +// uint8 zeroes[4] = {0, 0, 0, 0}; |
| +// uint8 buf1[4] = {0}; |
| +// EXPECT_CALL(callback_, |
| +// OnMoreData(NotNull(), 4, |
| +// AllOf(Field(&AudioBuffersState::pending_bytes, 0), |
| +// Field(&AudioBuffersState::hardware_delay_bytes, 0)))) |
| +// .WillOnce(DoAll(SetArrayArgument<0>(zeroes, zeroes + sizeof(zeroes)), |
| +// Return(4))); |
| +// mixer_->OnMoreData(buf1, sizeof(buf1), AudioBuffersState(0, 0)); |
| +// proxy2->Start(&callback_); |
| +// uint8 buf2[4] = {0}; |
| +// EXPECT_CALL(callback_, |
| +// OnMoreData(NotNull(), 4, |
| +// AllOf(Field(&AudioBuffersState::pending_bytes, 4), |
| +// Field(&AudioBuffersState::hardware_delay_bytes, 0)))) |
| +// .WillOnce(DoAll(SetArrayArgument<0>(zeroes, zeroes + sizeof(zeroes)), |
| +// Return(4))); |
| +// EXPECT_CALL(callback_, |
| +// OnMoreData(NotNull(), 4, |
| +// AllOf(Field(&AudioBuffersState::pending_bytes, 0), |
| +// Field(&AudioBuffersState::hardware_delay_bytes, 0)))) |
| +// .WillOnce(DoAll(SetArrayArgument<0>(zeroes, zeroes + sizeof(zeroes)), |
| +// Return(4))); |
| +// mixer_->OnMoreData(buf2, sizeof(buf2), AudioBuffersState(4, 0)); |
| +// proxy1->Stop(); |
| +// proxy2->Stop(); |
| + |
| +// proxy1->Close(); |
| +// proxy2->Close(); |
| +// WaitForCloseTimer(kTestCloseDelayMs); |
| +// } |
| TEST_F(AudioOutputProxyTest, OpenFailed) { |
| OpenFailed(dispatcher_impl_); |
| } |
| -TEST_F(AudioOutputProxyTest, OpenFailed_Mixer) { |
| - OpenFailed(mixer_); |
| -} |
| +// TODO(dalecurtis): Temporarily disabled while switching over to floats. |
| +// TEST_F(AudioOutputProxyTest, OpenFailed_Mixer) { |
| +// OpenFailed(mixer_); |
| +// } |
| // Start() method failed. |
| TEST_F(AudioOutputProxyTest, StartFailed) { |
| @@ -542,48 +552,49 @@ TEST_F(AudioOutputProxyTest, StartFailed) { |
| proxy->Close(); |
| } |
| +// TODO(dalecurtis): Temporarily disabled while switching over to floats. |
| // Start() method failed. |
| -TEST_F(AudioOutputProxyTest, StartFailed_Mixer) { |
| - MockAudioOutputStream stream; |
| - |
| - EXPECT_CALL(manager(), MakeAudioOutputStream(_)) |
| - .WillOnce(Return(&stream)); |
| - EXPECT_CALL(stream, Open()) |
| - .WillOnce(Return(true)); |
| - EXPECT_CALL(stream, Close()) |
| - .Times(1); |
| - EXPECT_CALL(stream, Start(_)) |
| - .Times(1); |
| - EXPECT_CALL(stream, SetVolume(_)) |
| - .Times(1); |
| - EXPECT_CALL(stream, Stop()) |
| - .Times(1); |
| - |
| - AudioOutputProxy* proxy1 = new AudioOutputProxy(mixer_); |
| - AudioOutputProxy* proxy2 = new AudioOutputProxy(mixer_); |
| - EXPECT_TRUE(proxy1->Open()); |
| - EXPECT_TRUE(proxy2->Open()); |
| - proxy1->Start(&callback_); |
| - proxy1->Stop(); |
| - proxy1->Close(); |
| - WaitForCloseTimer(kTestCloseDelayMs); |
| - |
| - // Verify expectation before continueing. |
| - Mock::VerifyAndClear(&stream); |
| - |
| - // |stream| is closed at this point. Start() should reopen it again. |
| - EXPECT_CALL(manager(), MakeAudioOutputStream(_)) |
| - .WillOnce(Return(reinterpret_cast<AudioOutputStream*>(NULL))); |
| - |
| - EXPECT_CALL(callback_, OnError(_, _)) |
| - .Times(1); |
| - |
| - proxy2->Start(&callback_); |
| - |
| - Mock::VerifyAndClear(&callback_); |
| - |
| - proxy2->Close(); |
| - WaitForCloseTimer(kTestCloseDelayMs); |
| -} |
| +// TEST_F(AudioOutputProxyTest, StartFailed_Mixer) { |
| +// MockAudioOutputStream stream; |
| + |
| +// EXPECT_CALL(manager(), MakeAudioOutputStream(_)) |
| +// .WillOnce(Return(&stream)); |
| +// EXPECT_CALL(stream, Open()) |
| +// .WillOnce(Return(true)); |
| +// EXPECT_CALL(stream, Close()) |
| +// .Times(1); |
| +// EXPECT_CALL(stream, Start(_)) |
| +// .Times(1); |
| +// EXPECT_CALL(stream, SetVolume(_)) |
| +// .Times(1); |
| +// EXPECT_CALL(stream, Stop()) |
| +// .Times(1); |
| + |
| +// AudioOutputProxy* proxy1 = new AudioOutputProxy(mixer_); |
| +// AudioOutputProxy* proxy2 = new AudioOutputProxy(mixer_); |
| +// EXPECT_TRUE(proxy1->Open()); |
| +// EXPECT_TRUE(proxy2->Open()); |
| +// proxy1->Start(&callback_); |
| +// proxy1->Stop(); |
| +// proxy1->Close(); |
| +// WaitForCloseTimer(kTestCloseDelayMs); |
| + |
| +// // Verify expectation before continueing. |
| +// Mock::VerifyAndClear(&stream); |
| + |
| +// // |stream| is closed at this point. Start() should reopen it again. |
| +// EXPECT_CALL(manager(), MakeAudioOutputStream(_)) |
| +// .WillOnce(Return(reinterpret_cast<AudioOutputStream*>(NULL))); |
| + |
| +// EXPECT_CALL(callback_, OnError(_, _)) |
| +// .Times(1); |
| + |
| +// proxy2->Start(&callback_); |
| + |
| +// Mock::VerifyAndClear(&callback_); |
| + |
| +// proxy2->Close(); |
| +// WaitForCloseTimer(kTestCloseDelayMs); |
| +// } |
| } // namespace media |