Index: content/renderer/media/webrtc_audio_device_unittest.cc |
=================================================================== |
--- content/renderer/media/webrtc_audio_device_unittest.cc (revision 114012) |
+++ content/renderer/media/webrtc_audio_device_unittest.cc (working copy) |
@@ -157,39 +157,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( |
@@ -212,8 +182,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; |
@@ -286,8 +254,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; |
@@ -355,8 +321,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; |
@@ -403,11 +367,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, |
MessageLoop::QuitClosure(), |
- TestTimeouts::action_timeout_ms()); |
+ 2000); |
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()); |
} |
@@ -420,8 +389,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; |