| 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();
|
|
|