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

Unified Diff: media/audio/audio_output_controller_unittest.cc

Issue 3192017: Revert 57254 - Share one thread between all AudioOutputControllers instead of... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 4 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') | media/audio/fake_audio_input_stream_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_output_controller_unittest.cc
===================================================================
--- media/audio/audio_output_controller_unittest.cc (revision 57255)
+++ media/audio/audio_output_controller_unittest.cc (working copy)
@@ -14,7 +14,6 @@
using ::testing::Exactly;
using ::testing::InvokeWithoutArgs;
using ::testing::NotNull;
-using ::testing::Return;
static const int kSampleRate = AudioManager::kAudioCDSampleRate;
static const int kBitsPerSample = 16;
@@ -69,10 +68,6 @@
return false;
}
-ACTION_P(SignalEvent, event) {
- event->Signal();
-}
-
ACTION_P3(SignalEvent, event, count, limit) {
if (++*count >= limit) {
event->Signal();
@@ -91,10 +86,7 @@
kHardwareBufferSize, kBufferCapacity);
ASSERT_TRUE(controller.get());
- // Close the controller immediately. At this point, chances are that
- // DoCreate() hasn't been called yet. In any case, it should be safe to call
- // Close() and it should not try to call |event_handler| later (the test
- // would crash otherwise).
+ // Close the controller immediately.
controller->Close();
}
@@ -108,7 +100,7 @@
// If OnCreated is called then signal the event.
EXPECT_CALL(event_handler, OnCreated(NotNull()))
- .WillOnce(SignalEvent(&event));
+ .WillOnce(InvokeWithoutArgs(&event, &base::WaitableEvent::Signal));
// OnPlaying() will be called only once.
EXPECT_CALL(event_handler, OnPlaying(NotNull()))
@@ -128,13 +120,14 @@
// Wait for OnCreated() to be called.
event.Wait();
+ event.Reset();
// Play and then wait for the event to be signaled.
controller->Play();
event.Wait();
- // Now stop the controller. The object is freed later after DoClose() is
- // executed.
+ // Now stop the controller. This should shutdown the internal
+ // thread and we hold the only reference to it.
controller->Close();
}
@@ -185,8 +178,8 @@
controller->Pause();
event.Wait();
- // Now stop the controller. The object is freed later after DoClose() is
- // executed.
+ // Now stop the controller. This should shutdown the internal
+ // thread and we hold the only reference to it.
controller->Close();
}
@@ -249,8 +242,8 @@
controller->Play();
event.Wait();
- // Now stop the controller. The object is freed later after DoClose() is
- // executed.
+ // Now stop the controller. This should shutdown the internal
+ // thread and we hold the only reference to it.
controller->Close();
}
@@ -277,17 +270,6 @@
return;
MockAudioOutputControllerEventHandler event_handler;
- base::WaitableEvent event(false, false);
-
- // If OnCreated is called then signal the event.
- EXPECT_CALL(event_handler, OnCreated(NotNull()))
- .WillOnce(SignalEvent(&event));
-
- // One OnMoreData() is expected.
- EXPECT_CALL(event_handler, OnMoreData(NotNull(), _, 0))
- .Times(AtLeast(1))
- .WillRepeatedly(SignalEvent(&event));
-
scoped_refptr<AudioOutputController> controller =
AudioOutputController::Create(&event_handler,
AudioManager::AUDIO_PCM_LINEAR, kChannels,
@@ -295,12 +277,7 @@
kHardwareBufferSize, kBufferCapacity);
ASSERT_TRUE(controller.get());
- // Wait for OnCreated() to be called.
- event.Wait();
-
- // Wait for OnMoreData() to be called.
- event.Wait();
-
+ // Close the controller immediately.
controller->Close();
controller->Close();
}
« no previous file with comments | « media/audio/audio_output_controller.cc ('k') | media/audio/fake_audio_input_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698