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

Unified Diff: media/audio/audio_input_controller_unittest.cc

Issue 2132593002: Remove remaining calls to deprecated MessageLoop methods on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove ios call sites Created 4 years, 5 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
Index: media/audio/audio_input_controller_unittest.cc
diff --git a/media/audio/audio_input_controller_unittest.cc b/media/audio/audio_input_controller_unittest.cc
index 1c0aa96d35d55a432352a09c3ace3043f56cf5c7..ca326d8df29fb6f45c83506e9a729b16c7bd484b 100644
--- a/media/audio/audio_input_controller_unittest.cc
+++ b/media/audio/audio_input_controller_unittest.cc
@@ -26,9 +26,8 @@ static const int kBitsPerSample = 16;
static const ChannelLayout kChannelLayout = CHANNEL_LAYOUT_STEREO;
static const int kSamplesPerPacket = kSampleRate / 10;
-// Posts base::MessageLoop::QuitWhenIdleClosure() on specified message loop.
-ACTION_P(QuitMessageLoop, loop_or_proxy) {
- loop_or_proxy->PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
+ACTION_P(QuitRunLoop, run_loop) {
+ run_loop->QuitWhenIdle();
}
// Posts base::MessageLoop::QuitWhenIdleClosure() on specified message loop
@@ -89,11 +88,13 @@ class AudioInputControllerTest : public testing::Test {
// Test AudioInputController for create and close without recording audio.
TEST_F(AudioInputControllerTest, CreateAndClose) {
+ base::RunLoop run_loop;
+
MockAudioInputControllerEventHandler event_handler;
// OnCreated() will be posted once.
EXPECT_CALL(event_handler, OnCreated(NotNull()))
- .WillOnce(QuitMessageLoop(&message_loop_));
+ .WillOnce(QuitRunLoop(&run_loop));
AudioParameters params(AudioParameters::AUDIO_FAKE, kChannelLayout,
kSampleRate, kBitsPerSample, kSamplesPerPacket);
@@ -104,7 +105,7 @@ TEST_F(AudioInputControllerTest, CreateAndClose) {
ASSERT_TRUE(controller.get());
// Wait for OnCreated() to fire.
- base::RunLoop().Run();
+ run_loop.Run();
// Close the AudioInputController synchronously.
CloseAudioController(controller.get());
@@ -154,6 +155,8 @@ TEST_F(AudioInputControllerTest, RecordAndClose) {
// Disabled due to crbug.com/357569 and crbug.com/357501.
// TODO(henrika): Remove the test when the timer workaround has been removed.
TEST_F(AudioInputControllerTest, DISABLED_RecordAndError) {
+ base::RunLoop run_loop;
+
MockAudioInputControllerEventHandler event_handler;
int count = 0;
@@ -173,10 +176,10 @@ TEST_F(AudioInputControllerTest, DISABLED_RecordAndError) {
// OnError() will be called after the data stream stops while the
// controller is in a recording state.
- EXPECT_CALL(event_handler, OnError(NotNull(),
- AudioInputController::NO_DATA_ERROR))
+ EXPECT_CALL(event_handler,
+ OnError(NotNull(), AudioInputController::NO_DATA_ERROR))
.Times(Exactly(1))
- .WillOnce(QuitMessageLoop(&message_loop_));
+ .WillOnce(QuitRunLoop(&run_loop));
AudioParameters params(AudioParameters::AUDIO_FAKE, kChannelLayout,
kSampleRate, kBitsPerSample, kSamplesPerPacket);
@@ -191,7 +194,7 @@ TEST_F(AudioInputControllerTest, DISABLED_RecordAndError) {
controller->Record();
// Record and wait until ten OnData() callbacks are received.
- base::RunLoop().Run();
+ run_loop.Run();
// Stop the stream and verify that OnError() is posted.
AudioInputStream* stream = controller->stream_for_testing();

Powered by Google App Engine
This is Rietveld 408576698