Index: media/audio/audio_controller_unittest.cc |
diff --git a/media/audio/audio_controller_unittest.cc b/media/audio/audio_controller_unittest.cc |
index c2a30ae46ab5f2ebaac8c0be56c272019d1f8145..02467880b2e810b7f27b3c07e495a82144efdd64 100644 |
--- a/media/audio/audio_controller_unittest.cc |
+++ b/media/audio/audio_controller_unittest.cc |
@@ -71,6 +71,24 @@ ACTION_P3(SignalEvent, event, count, limit) { |
} |
} |
+TEST(AudioControllerTest, CreateAndClose) { |
+ if (!HasAudioDevices() || IsRunningHeadless()) |
+ return; |
+ |
+ MockAudioControllerEventHandler event_handler; |
+ scoped_refptr<AudioController> controller = AudioController::Create( |
+ &event_handler, AudioManager::AUDIO_PCM_LINEAR, kChannels, |
+ kSampleRate, kBitsPerSample, kHardwareBufferSize, kBufferCapacity); |
+ ASSERT_TRUE(controller.get()); |
+ |
+ // Close the controller immediately. |
+ controller->Close(); |
+ |
+ // TODO(hclam): Make sure releasing the reference to this |
+ // object actually destruct it. |
+ controller = NULL; |
+} |
+ |
TEST(AudioControllerTest, PlayAndClose) { |
if (!HasAudioDevices() || IsRunningHeadless()) |
return; |
@@ -184,4 +202,23 @@ TEST(AudioControllerTest, HardwareBufferTooLarge) { |
ASSERT_FALSE(controller); |
} |
+TEST(AudioControllerTest, CloseTwice) { |
+ if (!HasAudioDevices() || IsRunningHeadless()) |
+ return; |
+ |
+ MockAudioControllerEventHandler event_handler; |
+ scoped_refptr<AudioController> controller = AudioController::Create( |
+ &event_handler, AudioManager::AUDIO_PCM_LINEAR, kChannels, |
+ kSampleRate, kBitsPerSample, kHardwareBufferSize, kBufferCapacity); |
+ ASSERT_TRUE(controller.get()); |
+ |
+ // Close the controller immediately. |
+ controller->Close(); |
+ controller->Close(); |
+ |
+ // TODO(hclam): Make sure releasing the reference to this |
+ // object actually destruct it. |
+ controller = NULL; |
+} |
+ |
} // namespace media |