Chromium Code Reviews| Index: content/renderer/media/webrtc_audio_device_unittest.cc |
| =================================================================== |
| --- content/renderer/media/webrtc_audio_device_unittest.cc (revision 113173) |
| +++ content/renderer/media/webrtc_audio_device_unittest.cc (working copy) |
| @@ -136,39 +136,9 @@ |
| } // end namespace |
| -// Utility class to delete the AudioManager. |
| -// TODO(tommi): Remove when we've fixed issue 105249. |
| -class AutoAudioManagerCleanup { |
| - public: |
| - AutoAudioManagerCleanup() { |
| - // Log an error if a previous test didn't clean up the AudioManager. |
| - if (DeleteAndResurrect()) { |
| - LOG(ERROR) |
| - << "AudioManager singleton was not cleaned up by some previous test!"; |
| - } |
| - } |
| - ~AutoAudioManagerCleanup() { |
| - DeleteAndResurrect(); |
| - } |
| - |
| - private: |
| - // Returns true iff the AudioManager existed and was deleted. |
| - bool DeleteAndResurrect() { |
| - if (AudioManager::SingletonExists()) { |
| - AudioManager::Destroy(NULL); |
| - AudioManager::Resurrect(); |
| - return true; |
| - } |
| - return false; |
| - } |
| - |
| - DISALLOW_COPY_AND_ASSIGN(AutoAudioManagerCleanup); |
| -}; |
| - |
| // Basic test that instantiates and initializes an instance of |
| // WebRtcAudioDeviceImpl. |
| TEST_F(WebRTCAudioDeviceTest, Construct) { |
| - AutoAudioManagerCleanup audio_manager_cleanup; |
| AudioUtilNoHardware audio_util(48000.0, 48000.0); |
| SetAudioUtilCallback(&audio_util); |
| scoped_refptr<WebRtcAudioDeviceImpl> audio_device( |
| @@ -191,8 +161,6 @@ |
| // verify that streaming starts correctly. |
| // Disabled when running headless since the bots don't have the required config. |
| TEST_F(WebRTCAudioDeviceTest, StartPlayout) { |
| - AutoAudioManagerCleanup audio_manager_cleanup; |
| - |
| if (IsRunningHeadless()) |
| return; |
| @@ -265,8 +233,6 @@ |
| // that the audio capturing starts as it should. |
| // Disabled when running headless since the bots don't have the required config. |
| TEST_F(WebRTCAudioDeviceTest, StartRecording) { |
| - AutoAudioManagerCleanup audio_manager_cleanup; |
| - |
| if (IsRunningHeadless()) |
| return; |
| @@ -334,8 +300,6 @@ |
| // Uses WebRtcAudioDeviceImpl to play a local wave file. |
| // Disabled when running headless since the bots don't have the required config. |
| TEST_F(WebRTCAudioDeviceTest, PlayLocalFile) { |
| - AutoAudioManagerCleanup audio_manager_cleanup; |
| - |
| if (IsRunningHeadless()) |
| return; |
| @@ -382,11 +346,16 @@ |
| EXPECT_EQ(0, file->StartPlayingFileLocally(ch, file_path.c_str(), false, |
| webrtc::kFileFormatPcm16kHzFile)); |
| + // Play 2 seconds worth of audio and then quit. |
| message_loop_.PostDelayedTask(FROM_HERE, |
| new MessageLoop::QuitTask(), |
| - TestTimeouts::action_timeout_ms()); |
| + 2000); |
|
henrika (OOO until Aug 14)
2011/12/07 10:26:43
You will get a comment from Andrew on this one ;-)
tommi (sloooow) - chröme
2011/12/07 12:26:44
Ah, yes. So, I might as well preemptively answer
|
| message_loop_.Run(); |
| + |
| + EXPECT_EQ(0, base->StopSend(ch)); |
| + EXPECT_EQ(0, base->StopPlayout(ch)); |
| + EXPECT_EQ(0, base->DeleteChannel(ch)); |
| EXPECT_EQ(0, base->Terminate()); |
| } |
| @@ -399,8 +368,6 @@ |
| // TODO(henrika): improve quality by using a wideband codec, enabling noise- |
| // suppressions and perhaps also the digital AGC. |
| TEST_F(WebRTCAudioDeviceTest, FullDuplexAudio) { |
| - AutoAudioManagerCleanup audio_manager_cleanup; |
| - |
| if (IsRunningHeadless()) |
| return; |