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

Unified Diff: media/audio/audio_controller_unittest.cc

Issue 2861010: Some fixups for AudioController and unit tests (Closed)
Patch Set: fixes Created 10 years, 6 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
« no previous file with comments | « media/audio/audio_controller.cc ('k') | media/audio/linux/audio_manager_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « media/audio/audio_controller.cc ('k') | media/audio/linux/audio_manager_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698