diff options
author | xhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-14 05:08:32 +0000 |
---|---|---|
committer | xhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-14 05:08:32 +0000 |
commit | 643d544c3d07c78eef785ff5741ad5be54b99b6c (patch) | |
tree | 222a0d58c8a02109dc5170840cc4b768baa5d98c /media | |
parent | a9992c0a14ef3e7d165484b50f7c22802bf93315 (diff) | |
download | chromium_src-643d544c3d07c78eef785ff5741ad5be54b99b6c.zip chromium_src-643d544c3d07c78eef785ff5741ad5be54b99b6c.tar.gz chromium_src-643d544c3d07c78eef785ff5741ad5be54b99b6c.tar.bz2 |
media: Update calls from RunAllPending() to RunUntilIdle().
RunAllPending() is deprecated and we should all switch to RunUntilIdle() now.
BUG=131220
TEST=media_unittests, content_unittests
Review URL: https://chromiumcodereview.appspot.com/11359193
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167602 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/audio/async_socket_io_handler_unittest.cc | 4 | ||||
-rw-r--r-- | media/audio/audio_low_latency_input_output_unittest.cc | 2 | ||||
-rw-r--r-- | media/audio/audio_output_device_unittest.cc | 8 | ||||
-rw-r--r-- | media/audio/audio_output_proxy_unittest.cc | 18 | ||||
-rw-r--r-- | media/base/pipeline_unittest.cc | 30 | ||||
-rw-r--r-- | media/filters/decrypting_audio_decoder_unittest.cc | 20 | ||||
-rw-r--r-- | media/filters/decrypting_video_decoder_unittest.cc | 26 | ||||
-rw-r--r-- | media/filters/ffmpeg_audio_decoder_unittest.cc | 4 | ||||
-rw-r--r-- | media/filters/ffmpeg_demuxer_unittest.cc | 60 | ||||
-rw-r--r-- | media/filters/ffmpeg_video_decoder_unittest.cc | 36 |
10 files changed, 104 insertions, 104 deletions
diff --git a/media/audio/async_socket_io_handler_unittest.cc b/media/audio/async_socket_io_handler_unittest.cc index 8748198..c7fa47b 100644 --- a/media/audio/async_socket_io_handler_unittest.cc +++ b/media/audio/async_socket_io_handler_unittest.cc @@ -106,10 +106,10 @@ TEST(AsyncSocketIoHandlerTest, SynchronousReadWithMessageLoop) { // We've now verified that the read happened synchronously, but it's not // guaranteed that the callback has been issued since the callback will be // called asynchronously even though the read may have been done. - // So we call RunAllPending() to allow any event notifications or APC's on + // So we call RunUntilIdle() to allow any event notifications or APC's on // Windows, to execute before checking the count of how many callbacks we've // received. - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(1, reader.callbacks_received()); } diff --git a/media/audio/audio_low_latency_input_output_unittest.cc b/media/audio/audio_low_latency_input_output_unittest.cc index 9376db8..069244b 100644 --- a/media/audio/audio_low_latency_input_output_unittest.cc +++ b/media/audio/audio_low_latency_input_output_unittest.cc @@ -455,7 +455,7 @@ TEST_F(AudioLowLatencyInputOutputTest, DISABLED_FullDuplexDelayMeasurement) { // All Close() operations that run on the mocked audio thread, // should be synchronous and not post additional close tasks to // mocked the audio thread. Hence, there is no need to call - // message_loop()->RunAllPending() after the Close() methods. + // message_loop()->RunUntilIdle() after the Close() methods. aos->Close(); ais->Close(); } diff --git a/media/audio/audio_output_device_unittest.cc b/media/audio/audio_output_device_unittest.cc index e1538da..3952cf3 100644 --- a/media/audio/audio_output_device_unittest.cc +++ b/media/audio/audio_output_device_unittest.cc @@ -166,7 +166,7 @@ void AudioOutputDeviceTest::Initialize() { audio_device_->Initialize(default_audio_parameters_, &callback_); } - io_loop_.RunAllPending(); + io_loop_.RunUntilIdle(); } void AudioOutputDeviceTest::StartAudioDevice() { @@ -176,7 +176,7 @@ void AudioOutputDeviceTest::StartAudioDevice() { .WillOnce(Return(kStreamId)); EXPECT_CALL(audio_output_ipc_, CreateStream(kStreamId, _, _)); - io_loop_.RunAllPending(); + io_loop_.RunUntilIdle(); } void AudioOutputDeviceTest::CreateStream() { @@ -200,7 +200,7 @@ void AudioOutputDeviceTest::CreateStream() { audio_device_->OnStreamCreated(duplicated_memory_handle, audio_device_socket, PacketSizeInBytes(kMemorySize)); - io_loop_.RunAllPending(); + io_loop_.RunUntilIdle(); } void AudioOutputDeviceTest::ExpectRenderCallback() { @@ -247,7 +247,7 @@ void AudioOutputDeviceTest::StopAudioDevice() { EXPECT_CALL(audio_output_ipc_, CloseStream(kStreamId)); EXPECT_CALL(audio_output_ipc_, RemoveDelegate(kStreamId)); - io_loop_.RunAllPending(); + io_loop_.RunUntilIdle(); } TEST_P(AudioOutputDeviceTest, Initialize) { diff --git a/media/audio/audio_output_proxy_unittest.cc b/media/audio/audio_output_proxy_unittest.cc index 8fce93e..6c13856 100644 --- a/media/audio/audio_output_proxy_unittest.cc +++ b/media/audio/audio_output_proxy_unittest.cc @@ -157,13 +157,13 @@ class AudioOutputProxyTest : public testing::Test { // This is necessary to free all proxy objects that have been // closed by the test. - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } virtual void InitDispatcher(base::TimeDelta close_delay) { // Use a low sample rate and large buffer size when testing otherwise the // FakeAudioOutputStream will keep the message loop busy indefinitely; i.e., - // RunAllPending() will never terminate. + // RunUntilIdle() will never terminate. params_ = AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_STEREO, 8000, 16, 2048); dispatcher_impl_ = new AudioOutputDispatcherImpl(&manager(), @@ -186,10 +186,10 @@ class AudioOutputProxyTest : public testing::Test { // Wait for the close timer to fire. void WaitForCloseTimer(const int timer_delay_ms) { - message_loop_.RunAllPending(); // OpenTask() may reset the timer. + message_loop_.RunUntilIdle(); // OpenTask() may reset the timer. base::PlatformThread::Sleep( base::TimeDelta::FromMilliseconds(timer_delay_ms) * 2); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Methods that do actual tests. @@ -324,7 +324,7 @@ class AudioOutputProxyTest : public testing::Test { // Simulate a delay. base::PlatformThread::Sleep( base::TimeDelta::FromMilliseconds(kTestCloseDelayMs) * 2); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Verify expectation before calling Close(). Mock::VerifyAndClear(&stream); @@ -360,7 +360,7 @@ class AudioOutputProxyTest : public testing::Test { EXPECT_TRUE(proxy2->Open()); proxy1->Start(&callback_); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); OnStart(); proxy1->Stop(); @@ -429,7 +429,7 @@ class AudioOutputProxyTest : public testing::Test { // Simulate a delay. base::PlatformThread::Sleep( base::TimeDelta::FromMilliseconds(kTestCloseDelayMs) * 2); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Verify expectation before calling Close(). Mock::VerifyAndClear(&stream); @@ -469,7 +469,7 @@ class AudioOutputResamplerTest : public AudioOutputProxyTest { AudioOutputProxyTest::InitDispatcher(close_delay); // Use a low sample rate and large buffer size when testing otherwise the // FakeAudioOutputStream will keep the message loop busy indefinitely; i.e., - // RunAllPending() will never terminate. + // RunUntilIdle() will never terminate. resampler_params_ = AudioParameters( AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO, 16000, 16, 1024); @@ -479,7 +479,7 @@ class AudioOutputResamplerTest : public AudioOutputProxyTest { virtual void OnStart() { // Let start run for a bit. - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); base::PlatformThread::Sleep( base::TimeDelta::FromMilliseconds(kStartRunTimeMs)); } diff --git a/media/base/pipeline_unittest.cc b/media/base/pipeline_unittest.cc index 8c82933..085aa8a 100644 --- a/media/base/pipeline_unittest.cc +++ b/media/base/pipeline_unittest.cc @@ -111,7 +111,7 @@ class PipelineTest : public ::testing::Test { EXPECT_CALL(callbacks_, OnStop()); pipeline_->Stop(base::Bind(&CallbackHelper::OnStop, base::Unretained(&callbacks_))); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); pipeline_ = NULL; mocks_.reset(); @@ -207,7 +207,7 @@ class PipelineTest : public ::testing::Test { base::Bind(&CallbackHelper::OnStart, base::Unretained(&callbacks_)), base::Bind(&CallbackHelper::OnBufferingState, base::Unretained(&callbacks_))); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } void CreateAudioStream() { @@ -272,7 +272,7 @@ class PipelineTest : public ::testing::Test { // We expect the time to be updated only after the seek has completed. EXPECT_NE(seek_time, pipeline_->GetMediaTime()); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); EXPECT_EQ(seek_time, pipeline_->GetMediaTime()); } @@ -340,7 +340,7 @@ TEST_F(PipelineTest, NeverInitializes) { base::Bind(&CallbackHelper::OnStart, base::Unretained(&callbacks_)), base::Bind(&CallbackHelper::OnBufferingState, base::Unretained(&callbacks_))); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Because our callback will get executed when the test tears down, we'll @@ -574,11 +574,11 @@ TEST_F(PipelineTest, EndedCallback) { // The ended callback shouldn't run until both renderers have ended. pipeline_->OnAudioRendererEnded(); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); EXPECT_CALL(callbacks_, OnEnded(PIPELINE_OK)); pipeline_->OnVideoRendererEnded(); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Static function & time variable used to simulate changes in wallclock time. @@ -612,7 +612,7 @@ TEST_F(PipelineTest, AudioStreamShorterThanVideo) { EXPECT_CALL(*mocks_->video_renderer(), SetPlaybackRate(playback_rate)); EXPECT_CALL(*mocks_->audio_renderer(), SetPlaybackRate(playback_rate)); pipeline_->SetPlaybackRate(playback_rate); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); InSequence s; @@ -625,7 +625,7 @@ TEST_F(PipelineTest, AudioStreamShorterThanVideo) { // Signal end of audio stream. pipeline_->OnAudioRendererEnded(); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Verify that the clock advances. start_time = pipeline_->GetMediaTime().ToInternalValue(); @@ -651,7 +651,7 @@ TEST_F(PipelineTest, ErrorDuringSeek) { EXPECT_CALL(*mocks_->demuxer(), SetPlaybackRate(playback_rate)); EXPECT_CALL(*mocks_->audio_renderer(), SetPlaybackRate(playback_rate)); pipeline_->SetPlaybackRate(playback_rate); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); base::TimeDelta seek_time = base::TimeDelta::FromSeconds(5); @@ -671,7 +671,7 @@ TEST_F(PipelineTest, ErrorDuringSeek) { pipeline_->Seek(seek_time, base::Bind(&CallbackHelper::OnSeek, base::Unretained(&callbacks_))); EXPECT_CALL(callbacks_, OnSeek(PIPELINE_ERROR_READ)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Invoked function OnError. This asserts that the pipeline does not enqueue @@ -726,7 +726,7 @@ TEST_F(PipelineTest, NoMessageDuringTearDownFromError) { pipeline_->Seek(seek_time, base::Bind(&CallbackHelper::OnSeek, base::Unretained(&callbacks_))); EXPECT_CALL(callbacks_, OnSeek(PIPELINE_ERROR_READ)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } TEST_F(PipelineTest, StartTimeIsZero) { @@ -786,7 +786,7 @@ TEST_F(PipelineTest, AudioTimeUpdateDuringSeek) { EXPECT_CALL(*mocks_->demuxer(), SetPlaybackRate(playback_rate)); EXPECT_CALL(*mocks_->audio_renderer(), SetPlaybackRate(playback_rate)); pipeline_->SetPlaybackRate(playback_rate); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Provide an initial time update so that the pipeline transitions out of the // "waiting for time update" state. @@ -944,7 +944,7 @@ class PipelineTeardownTest : public PipelineTest { base::Bind(&CallbackHelper::OnStart, base::Unretained(&callbacks_)), base::Bind(&CallbackHelper::OnBufferingState, base::Unretained(&callbacks_))); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } PipelineStatus SetInitializeExpectations(TeardownState state, @@ -1062,7 +1062,7 @@ class PipelineTeardownTest : public PipelineTest { pipeline_->Seek(base::TimeDelta::FromSeconds(10), base::Bind( &CallbackHelper::OnSeek, base::Unretained(&callbacks_))); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } PipelineStatus SetSeekExpectations(TeardownState state, @@ -1177,7 +1177,7 @@ class PipelineTeardownTest : public PipelineTest { pipeline_->SetErrorForTesting(PIPELINE_ERROR_READ); } - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } DISALLOW_COPY_AND_ASSIGN(PipelineTeardownTest); diff --git a/media/filters/decrypting_audio_decoder_unittest.cc b/media/filters/decrypting_audio_decoder_unittest.cc index 24e9eba..a191308 100644 --- a/media/filters/decrypting_audio_decoder_unittest.cc +++ b/media/filters/decrypting_audio_decoder_unittest.cc @@ -99,7 +99,7 @@ class DecryptingAudioDecoderTest : public testing::Test { decoder_->Initialize(demuxer_, NewExpectedStatusCB(status), base::Bind(&MockStatisticsCB::OnStatistics, base::Unretained(&statistics_cb_))); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } void Initialize() { @@ -132,7 +132,7 @@ class DecryptingAudioDecoderTest : public testing::Test { decoder_->Read(base::Bind(&DecryptingAudioDecoderTest::FrameReady, base::Unretained(this))); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Sets up expectations and actions to put DecryptingAudioDecoder in an @@ -166,7 +166,7 @@ class DecryptingAudioDecoderTest : public testing::Test { .WillOnce(SaveArg<0>(&pending_demuxer_read_cb_)); decoder_->Read(base::Bind(&DecryptingAudioDecoderTest::FrameReady, base::Unretained(this))); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Make sure the Read() on the decoder triggers a Read() on the demuxer. EXPECT_FALSE(pending_demuxer_read_cb_.is_null()); } @@ -181,7 +181,7 @@ class DecryptingAudioDecoderTest : public testing::Test { decoder_->Read(base::Bind(&DecryptingAudioDecoderTest::FrameReady, base::Unretained(this))); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Make sure the Read() on the decoder triggers a DecryptAndDecode() on the // decryptor. EXPECT_FALSE(pending_audio_decode_cb_.is_null()); @@ -195,7 +195,7 @@ class DecryptingAudioDecoderTest : public testing::Test { Decryptor::AudioBuffers())); decoder_->Read(base::Bind(&DecryptingAudioDecoderTest::FrameReady, base::Unretained(this))); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } void AbortPendingAudioDecodeCB() { @@ -211,7 +211,7 @@ class DecryptingAudioDecoderTest : public testing::Test { this, &DecryptingAudioDecoderTest::AbortPendingAudioDecodeCB)); decoder_->Reset(NewExpectedClosure()); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } MOCK_METHOD1(RequestDecryptorNotification, @@ -352,7 +352,7 @@ TEST_F(DecryptingAudioDecoderTest, KeyAdded_DuringWaitingForKey) { EXPECT_CALL(statistics_cb_, OnStatistics(_)); EXPECT_CALL(*this, FrameReady(AudioDecoder::kOk, decoded_frame_)); key_added_cb_.Run(); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Test the case where the a key is added when the decryptor is in @@ -370,7 +370,7 @@ TEST_F(DecryptingAudioDecoderTest, KeyAdded_DruingPendingDecode) { key_added_cb_.Run(); base::ResetAndReturn(&pending_audio_decode_cb_).Run( Decryptor::kNoKey, Decryptor::AudioBuffers()); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Test resetting when the decoder is in kIdle state but has not decoded any @@ -398,7 +398,7 @@ TEST_F(DecryptingAudioDecoderTest, Reset_DuringPendingDemuxerRead) { Reset(); base::ResetAndReturn(&pending_demuxer_read_cb_).Run(DemuxerStream::kOk, encrypted_buffer_); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Test resetting when the decoder is in kPendingDecode state. @@ -460,7 +460,7 @@ TEST_F(DecryptingAudioDecoderTest, DemuxerRead_AbortedDuringReset) { Reset(); base::ResetAndReturn(&pending_demuxer_read_cb_).Run(DemuxerStream::kAborted, NULL); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Test config change on the demuxer stream. diff --git a/media/filters/decrypting_video_decoder_unittest.cc b/media/filters/decrypting_video_decoder_unittest.cc index d35facf..aa06d41 100644 --- a/media/filters/decrypting_video_decoder_unittest.cc +++ b/media/filters/decrypting_video_decoder_unittest.cc @@ -102,7 +102,7 @@ class DecryptingVideoDecoderTest : public testing::Test { decoder_->Initialize(demuxer_, NewExpectedStatusCB(status), base::Bind(&MockStatisticsCB::OnStatistics, base::Unretained(&statistics_cb_))); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } void Initialize() { @@ -131,7 +131,7 @@ class DecryptingVideoDecoderTest : public testing::Test { decoder_->Read(base::Bind(&DecryptingVideoDecoderTest::FrameReady, base::Unretained(this))); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Sets up expectations and actions to put DecryptingVideoDecoder in an @@ -163,7 +163,7 @@ class DecryptingVideoDecoderTest : public testing::Test { .WillOnce(SaveArg<0>(&pending_demuxer_read_cb_)); decoder_->Read(base::Bind(&DecryptingVideoDecoderTest::FrameReady, base::Unretained(this))); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Make sure the Read() on the decoder triggers a Read() on the demuxer. EXPECT_FALSE(pending_demuxer_read_cb_.is_null()); } @@ -178,7 +178,7 @@ class DecryptingVideoDecoderTest : public testing::Test { decoder_->Read(base::Bind(&DecryptingVideoDecoderTest::FrameReady, base::Unretained(this))); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Make sure the Read() on the decoder triggers a DecryptAndDecode() on the // decryptor. EXPECT_FALSE(pending_video_decode_cb_.is_null()); @@ -191,7 +191,7 @@ class DecryptingVideoDecoderTest : public testing::Test { .WillRepeatedly(RunCallback<1>(Decryptor::kNoKey, null_video_frame_)); decoder_->Read(base::Bind(&DecryptingVideoDecoderTest::FrameReady, base::Unretained(this))); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } void AbortPendingVideoDecodeCB() { @@ -217,7 +217,7 @@ class DecryptingVideoDecoderTest : public testing::Test { this, &DecryptingVideoDecoderTest::AbortPendingVideoDecodeCB)); decoder_->Reset(NewExpectedClosure()); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } void Stop() { @@ -229,7 +229,7 @@ class DecryptingVideoDecoderTest : public testing::Test { this, &DecryptingVideoDecoderTest::AbortAllPendingCBs)); decoder_->Stop(NewExpectedClosure()); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } MOCK_METHOD1(RequestDecryptorNotification, @@ -355,7 +355,7 @@ TEST_F(DecryptingVideoDecoderTest, KeyAdded_DuringWaitingForKey) { EXPECT_CALL(statistics_cb_, OnStatistics(_)); EXPECT_CALL(*this, FrameReady(VideoDecoder::kOk, decoded_video_frame_)); key_added_cb_.Run(); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Test the case where the a key is added when the decryptor is in @@ -374,7 +374,7 @@ TEST_F(DecryptingVideoDecoderTest, KeyAdded_DruingPendingDecode) { key_added_cb_.Run(); base::ResetAndReturn(&pending_video_decode_cb_).Run(Decryptor::kNoKey, null_video_frame_); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Test resetting when the decoder is in kIdle state but has not decoded any @@ -402,7 +402,7 @@ TEST_F(DecryptingVideoDecoderTest, Reset_DuringPendingDemuxerRead) { Reset(); base::ResetAndReturn(&pending_demuxer_read_cb_).Run(DemuxerStream::kOk, encrypted_buffer_); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Test resetting when the decoder is in kPendingDecode state. @@ -456,7 +456,7 @@ TEST_F(DecryptingVideoDecoderTest, Stop_DuringDecryptorRequested) { NewExpectedStatusCB(DECODER_ERROR_NOT_SUPPORTED), base::Bind(&MockStatisticsCB::OnStatistics, base::Unretained(&statistics_cb_))); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // |decryptor_notification_cb| is saved but not called here. EXPECT_FALSE(decryptor_notification_cb.is_null()); @@ -507,7 +507,7 @@ TEST_F(DecryptingVideoDecoderTest, Stop_DuringPendingDemuxerRead) { Stop(); base::ResetAndReturn(&pending_demuxer_read_cb_).Run(DemuxerStream::kOk, encrypted_buffer_); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Test stopping when the decoder is in kPendingDecode state. @@ -591,7 +591,7 @@ TEST_F(DecryptingVideoDecoderTest, DemuxerRead_AbortedDuringReset) { Reset(); base::ResetAndReturn(&pending_demuxer_read_cb_).Run(DemuxerStream::kAborted, NULL); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Test config change on the demuxer stream. diff --git a/media/filters/ffmpeg_audio_decoder_unittest.cc b/media/filters/ffmpeg_audio_decoder_unittest.cc index 7acb996..cafaeac 100644 --- a/media/filters/ffmpeg_audio_decoder_unittest.cc +++ b/media/filters/ffmpeg_audio_decoder_unittest.cc @@ -77,7 +77,7 @@ class FFmpegAudioDecoderTest : public testing::Test { base::Bind(&MockStatisticsCB::OnStatistics, base::Unretained(&statistics_cb_))); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } void ReadPacket(const DemuxerStream::ReadCB& read_cb) { @@ -93,7 +93,7 @@ class FFmpegAudioDecoderTest : public testing::Test { void Read() { decoder_->Read(base::Bind( &FFmpegAudioDecoderTest::DecodeFinished, base::Unretained(this))); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } void DecodeFinished(AudioDecoder::Status status, diff --git a/media/filters/ffmpeg_demuxer_unittest.cc b/media/filters/ffmpeg_demuxer_unittest.cc index 2aff102..26a5017 100644 --- a/media/filters/ffmpeg_demuxer_unittest.cc +++ b/media/filters/ffmpeg_demuxer_unittest.cc @@ -66,7 +66,7 @@ class FFmpegDemuxerTest : public testing::Test { } // Finish up any remaining tasks. - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Release the reference to the demuxer. demuxer_ = NULL; } @@ -88,7 +88,7 @@ class FFmpegDemuxerTest : public testing::Test { void InitializeDemuxer() { EXPECT_CALL(host_, SetDuration(_)); demuxer_->Initialize(&host_, NewExpectedStatusCB(PIPELINE_OK)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } MOCK_METHOD2(OnReadDoneCalled, void(int, int64)); @@ -149,7 +149,7 @@ class FFmpegDemuxerTest : public testing::Test { const int kMaxBuffers = 170; for (int i = 0; !got_eos_buffer && i < kMaxBuffers; i++) { audio->Read(base::Bind(&EosOnReadDone, &got_eos_buffer)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } EXPECT_TRUE(got_eos_buffer); @@ -180,7 +180,7 @@ TEST_F(FFmpegDemuxerTest, Initialize_OpenFails) { demuxer_->Initialize( &host_, NewExpectedStatusCB(DEMUXER_ERROR_COULD_NOT_OPEN)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // TODO(acolwell): Uncomment this test when we discover a file that passes @@ -190,7 +190,7 @@ TEST_F(FFmpegDemuxerTest, Initialize_OpenFails) { // ("find_stream_info_fail.webm"); // demuxer_->Initialize( // &host_, NewExpectedStatusCB(DEMUXER_ERROR_COULD_NOT_PARSE)); -// message_loop_.RunAllPending(); +// message_loop_.RunUntilIdle(); //} TEST_F(FFmpegDemuxerTest, Initialize_NoStreams) { @@ -198,7 +198,7 @@ TEST_F(FFmpegDemuxerTest, Initialize_NoStreams) { CreateDemuxer("no_streams.webm"); demuxer_->Initialize( &host_, NewExpectedStatusCB(DEMUXER_ERROR_NO_SUPPORTED_STREAMS)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } TEST_F(FFmpegDemuxerTest, Initialize_NoAudioVideo) { @@ -206,7 +206,7 @@ TEST_F(FFmpegDemuxerTest, Initialize_NoAudioVideo) { CreateDemuxer("no_audio_video.webm"); demuxer_->Initialize( &host_, NewExpectedStatusCB(DEMUXER_ERROR_NO_SUPPORTED_STREAMS)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } TEST_F(FFmpegDemuxerTest, Initialize_Successful) { @@ -289,10 +289,10 @@ TEST_F(FFmpegDemuxerTest, Read_Audio) { demuxer_->GetStream(DemuxerStream::AUDIO); audio->Read(NewReadCB(FROM_HERE, 29, 0)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); audio->Read(NewReadCB(FROM_HERE, 27, 3000)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } TEST_F(FFmpegDemuxerTest, Read_Video) { @@ -305,10 +305,10 @@ TEST_F(FFmpegDemuxerTest, Read_Video) { demuxer_->GetStream(DemuxerStream::VIDEO); video->Read(NewReadCB(FROM_HERE, 22084, 0)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); video->Read(NewReadCB(FROM_HERE, 1057, 33000)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } TEST_F(FFmpegDemuxerTest, Read_VideoNonZeroStart) { @@ -324,11 +324,11 @@ TEST_F(FFmpegDemuxerTest, Read_VideoNonZeroStart) { // Check first buffer in video stream. video->Read(NewReadCB(FROM_HERE, 5636, 400000)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Check first buffer in audio stream. audio->Read(NewReadCB(FROM_HERE, 165, 396000)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Verify that the start time is equal to the lowest timestamp (ie the audio). EXPECT_EQ(demuxer_->GetStartTime().InMicroseconds(), 396000); @@ -366,28 +366,28 @@ TEST_F(FFmpegDemuxerTest, Seek) { // Read a video packet and release it. video->Read(NewReadCB(FROM_HERE, 22084, 0)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Issue a simple forward seek, which should discard queued packets. demuxer_->Seek(base::TimeDelta::FromMicroseconds(1000000), NewExpectedStatusCB(PIPELINE_OK)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Audio read #1. audio->Read(NewReadCB(FROM_HERE, 145, 803000)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Audio read #2. audio->Read(NewReadCB(FROM_HERE, 148, 826000)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Video read #1. video->Read(NewReadCB(FROM_HERE, 5425, 801000)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Video read #2. video->Read(NewReadCB(FROM_HERE, 1906, 834000)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // A mocked callback specialization for calling Read(). Since RunWithParams() @@ -440,7 +440,7 @@ TEST_F(FFmpegDemuxerTest, Stop) { // Attempt the read... audio->Read(base::Bind(&MockReadCB::Run, callback)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // ...and verify that |callback| was deleted. CheckPoint(1); @@ -462,7 +462,7 @@ TEST_F(FFmpegDemuxerTest, StreamReadAfterStopAndDemuxerDestruction) { demuxer_->Stop(NewExpectedClosure()); // Finish up any remaining tasks. - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Expect all calls in sequence. InSequence s; @@ -484,7 +484,7 @@ TEST_F(FFmpegDemuxerTest, StreamReadAfterStopAndDemuxerDestruction) { // Attempt the read... audio->Read(base::Bind(&MockReadCB::Run, callback)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // ...and verify that |callback| was deleted. CheckPoint(1); @@ -500,7 +500,7 @@ TEST_F(FFmpegDemuxerTest, DisableAudioStream) { // Submit a "disable audio stream" message to the demuxer. demuxer_->OnAudioRendererDisabled(); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Get our streams. scoped_refptr<DemuxerStream> video = @@ -516,7 +516,7 @@ TEST_F(FFmpegDemuxerTest, DisableAudioStream) { // Attempt a read from the video stream: it should return valid data. video->Read(NewReadCB(FROM_HERE, 22084, 0)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Attempt a read from the audio stream: it should immediately return end of // stream without requiring the message loop to read data. @@ -541,28 +541,28 @@ TEST_F(FFmpegDemuxerTest, SeekWithCuesBeforeFirstCluster) { // Read a video packet and release it. video->Read(NewReadCB(FROM_HERE, 22084, 0)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Issue a simple forward seek, which should discard queued packets. demuxer_->Seek(base::TimeDelta::FromMicroseconds(2500000), NewExpectedStatusCB(PIPELINE_OK)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Audio read #1. audio->Read(NewReadCB(FROM_HERE, 40, 2403000)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Audio read #2. audio->Read(NewReadCB(FROM_HERE, 42, 2406000)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Video read #1. video->Read(NewReadCB(FROM_HERE, 5276, 2402000)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Video read #2. video->Read(NewReadCB(FROM_HERE, 1740, 2436000)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Ensure ID3v1 tag reading is disabled. id3_test.mp3 has an ID3v1 tag with the diff --git a/media/filters/ffmpeg_video_decoder_unittest.cc b/media/filters/ffmpeg_video_decoder_unittest.cc index 9186ca3..6dd0c7c 100644 --- a/media/filters/ffmpeg_video_decoder_unittest.cc +++ b/media/filters/ffmpeg_video_decoder_unittest.cc @@ -113,7 +113,7 @@ class FFmpegVideoDecoderTest : public testing::Test { base::Bind(&MockStatisticsCB::OnStatistics, base::Unretained(&statistics_cb_))); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } void InitializeWithConfig(const VideoDecoderConfig& config) { @@ -131,7 +131,7 @@ class FFmpegVideoDecoderTest : public testing::Test { EXPECT_CALL(*decryptor_, CancelDecrypt(Decryptor::kVideo)) .WillOnce(Invoke(this, &FFmpegVideoDecoderTest::CancelDecrypt)); decoder_->Reset(NewExpectedClosure()); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } void Stop() { @@ -142,7 +142,7 @@ class FFmpegVideoDecoderTest : public testing::Test { .Times(AtMost(1)) .WillRepeatedly(Invoke(this, &FFmpegVideoDecoderTest::CancelDecrypt)); decoder_->Stop(NewExpectedClosure()); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Sets up expectations and actions to put FFmpegVideoDecoder in an active @@ -230,7 +230,7 @@ class FFmpegVideoDecoderTest : public testing::Test { decoder_->Read(read_cb_); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } MOCK_METHOD2(FrameReady, void(VideoDecoder::Status, @@ -418,7 +418,7 @@ TEST_F(FFmpegVideoDecoderTest, DecodeFrame_DecodeError) { EXPECT_EQ(VideoDecoder::kDecodeError, status); EXPECT_FALSE(video_frame); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Multi-threaded decoders have different behavior than single-threaded @@ -499,7 +499,7 @@ TEST_F(FFmpegVideoDecoderTest, DecodeEncryptedFrame_DecryptError) { EXPECT_EQ(VideoDecoder::kDecryptError, status); EXPECT_FALSE(video_frame); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Test the case that the decryptor has no key to decrypt the encrypted buffer. @@ -522,7 +522,7 @@ TEST_F(FFmpegVideoDecoderTest, DecodeEncryptedFrame_NoDecryptionKey) { EXPECT_EQ(VideoDecoder::kDecryptError, status); EXPECT_FALSE(video_frame); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Test the case that the decryptor fails to decrypt the encrypted buffer but @@ -549,7 +549,7 @@ TEST_F(FFmpegVideoDecoderTest, DecodeEncryptedFrame_CorruptedBufferReturned) { EXPECT_EQ(VideoDecoder::kDecodeError, status); EXPECT_FALSE(video_frame); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Test resetting when decoder has initialized but not decoded. @@ -582,7 +582,7 @@ TEST_F(FFmpegVideoDecoderTest, Reset_DuringPendingRead) { .WillOnce(SaveArg<0>(&read_cb)); decoder_->Read(read_cb_); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Make sure the Read() on the decoder triggers a Read() on // the demuxer. @@ -594,7 +594,7 @@ TEST_F(FFmpegVideoDecoderTest, Reset_DuringPendingRead) { EXPECT_CALL(*this, FrameReady(VideoDecoder::kOk, IsNull())); read_cb.Run(DemuxerStream::kOk, i_frame_buffer_); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Test resetting when there is a pending decrypt on the decryptor. @@ -608,13 +608,13 @@ TEST_F(FFmpegVideoDecoderTest, Reset_DuringPendingDecrypt) { .WillOnce(SaveArg<2>(&decrypt_cb_)); decoder_->Read(read_cb_); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Make sure the Read() on the decoder triggers a Decrypt() on the decryptor. EXPECT_FALSE(decrypt_cb_.is_null()); EXPECT_CALL(*this, FrameReady(VideoDecoder::kOk, IsNull())); Reset(); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Test stopping when decoder has initialized but not decoded. @@ -647,7 +647,7 @@ TEST_F(FFmpegVideoDecoderTest, Stop_DuringPendingRead) { .WillOnce(SaveArg<0>(&read_cb)); decoder_->Read(read_cb_); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Make sure the Read() on the decoder triggers a Read() on the demuxer. EXPECT_FALSE(read_cb.is_null()); @@ -657,7 +657,7 @@ TEST_F(FFmpegVideoDecoderTest, Stop_DuringPendingRead) { Stop(); read_cb.Run(DemuxerStream::kOk, i_frame_buffer_); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Test stopping when there is a pending decrypt on the decryptor. @@ -671,13 +671,13 @@ TEST_F(FFmpegVideoDecoderTest, Stop_DuringPendingDecrypt) { .WillOnce(SaveArg<2>(&decrypt_cb_)); decoder_->Read(read_cb_); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Make sure the Read() on the decoder triggers a Decrypt() on the decryptor. EXPECT_FALSE(decrypt_cb_.is_null()); EXPECT_CALL(*this, FrameReady(VideoDecoder::kOk, IsNull())); Stop(); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Test aborted read on the demuxer stream. @@ -707,7 +707,7 @@ TEST_F(FFmpegVideoDecoderTest, AbortPendingReadDuringReset) { decoder_->Read(read_cb_); EXPECT_CALL(*demuxer_, Read(_)) .WillOnce(SaveArg<0>(&read_cb)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); ASSERT_FALSE(read_cb.is_null()); // Reset while there is still an outstanding read on the demuxer. @@ -718,7 +718,7 @@ TEST_F(FFmpegVideoDecoderTest, AbortPendingReadDuringReset) { // Make sure we get a NULL video frame returned. EXPECT_CALL(*this, FrameReady(VideoDecoder::kOk, IsNull())); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } } // namespace media |