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

Unified Diff: media/audio/audio_output_controller_unittest.cc

Issue 9858007: Fix a couple of regressions that made it in before the weekend. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix media tests Created 8 years, 9 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_output_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_output_controller_unittest.cc
diff --git a/media/audio/audio_output_controller_unittest.cc b/media/audio/audio_output_controller_unittest.cc
index 3736a90ff05346c318133aa0f34364befe714c88..cd65f5bc6068608100509348acbcdd34026f0a36 100644
--- a/media/audio/audio_output_controller_unittest.cc
+++ b/media/audio/audio_output_controller_unittest.cc
@@ -6,6 +6,7 @@
#include "base/environment.h"
#include "base/basictypes.h"
#include "base/logging.h"
+#include "base/message_loop.h"
#include "base/synchronization/waitable_event.h"
#include "media/audio/audio_output_controller.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -65,13 +66,23 @@ ACTION_P(SignalEvent, event) {
// Closes AudioOutputController synchronously.
static void CloseAudioController(AudioOutputController* controller) {
- base::WaitableEvent closed_event(true, false);
- controller->Close(base::Bind(&base::WaitableEvent::Signal,
- base::Unretained(&closed_event)));
- closed_event.Wait();
+ controller->Close(MessageLoop::QuitClosure());
+ MessageLoop::current()->Run();
}
-TEST(AudioOutputControllerTest, CreateAndClose) {
+class AudioOutputControllerTest : public testing::Test {
+ public:
+ AudioOutputControllerTest() {}
+ virtual ~AudioOutputControllerTest() {}
+
+ protected:
+ MessageLoopForIO message_loop_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(AudioOutputControllerTest);
+};
+
+TEST_F(AudioOutputControllerTest, CreateAndClose) {
scoped_ptr<AudioManager> audio_manager(AudioManager::Create());
if (!audio_manager->HasAudioOutputDevices())
return;
@@ -95,7 +106,7 @@ TEST(AudioOutputControllerTest, CreateAndClose) {
CloseAudioController(controller);
}
-TEST(AudioOutputControllerTest, PlayPauseClose) {
+TEST_F(AudioOutputControllerTest, PlayPauseClose) {
scoped_ptr<AudioManager> audio_manager(AudioManager::Create());
if (!audio_manager->HasAudioOutputDevices())
return;
@@ -117,6 +128,8 @@ TEST(AudioOutputControllerTest, PlayPauseClose) {
EXPECT_CALL(sync_reader, Read(_, kHardwareBufferSize))
.WillRepeatedly(DoAll(SignalEvent(&event),
Return(4)));
+ EXPECT_CALL(sync_reader, DataReady())
+ .WillRepeatedly(Return(true));
EXPECT_CALL(event_handler, OnPaused(NotNull()))
.WillOnce(InvokeWithoutArgs(&pause_event, &base::WaitableEvent::Signal));
EXPECT_CALL(sync_reader, Close());
@@ -141,7 +154,7 @@ TEST(AudioOutputControllerTest, PlayPauseClose) {
}
-TEST(AudioOutputControllerTest, HardwareBufferTooLarge) {
+TEST_F(AudioOutputControllerTest, HardwareBufferTooLarge) {
scoped_ptr<AudioManager> audio_manager(AudioManager::Create());
if (!audio_manager->HasAudioOutputDevices())
return;
« no previous file with comments | « media/audio/audio_output_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698