| Index: media/filters/decrypting_video_decoder_unittest.cc
|
| diff --git a/media/filters/decrypting_video_decoder_unittest.cc b/media/filters/decrypting_video_decoder_unittest.cc
|
| index d35facf9622a952664e8a668dc9885f35146eba8..f1991d069ce32e022945bdbeea9bb0bc8acd8c40 100644
|
| --- a/media/filters/decrypting_video_decoder_unittest.cc
|
| +++ b/media/filters/decrypting_video_decoder_unittest.cc
|
| @@ -20,7 +20,6 @@
|
|
|
| using ::testing::_;
|
| using ::testing::AtMost;
|
| -using ::testing::Invoke;
|
| using ::testing::IsNull;
|
| using ::testing::ReturnRef;
|
| using ::testing::SaveArg;
|
| @@ -74,7 +73,7 @@ MATCHER(IsEndOfStream, "end of stream") {
|
| class DecryptingVideoDecoderTest : public testing::Test {
|
| public:
|
| DecryptingVideoDecoderTest()
|
| - : decoder_(new StrictMock<DecryptingVideoDecoder>(
|
| + : decoder_(new DecryptingVideoDecoder(
|
| base::Bind(&Identity<scoped_refptr<base::MessageLoopProxy> >,
|
| message_loop_.message_loop_proxy()),
|
| base::Bind(
|
| @@ -102,7 +101,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 +130,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 +162,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 +177,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 +190,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 +216,7 @@ class DecryptingVideoDecoderTest : public testing::Test {
|
| this, &DecryptingVideoDecoderTest::AbortPendingVideoDecodeCB));
|
|
|
| decoder_->Reset(NewExpectedClosure());
|
| - message_loop_.RunAllPending();
|
| + message_loop_.RunUntilIdle();
|
| }
|
|
|
| void Stop() {
|
| @@ -229,7 +228,7 @@ class DecryptingVideoDecoderTest : public testing::Test {
|
| this, &DecryptingVideoDecoderTest::AbortAllPendingCBs));
|
|
|
| decoder_->Stop(NewExpectedClosure());
|
| - message_loop_.RunAllPending();
|
| + message_loop_.RunUntilIdle();
|
| }
|
|
|
| MOCK_METHOD1(RequestDecryptorNotification,
|
| @@ -239,7 +238,7 @@ class DecryptingVideoDecoderTest : public testing::Test {
|
| const scoped_refptr<VideoFrame>&));
|
|
|
| MessageLoop message_loop_;
|
| - scoped_refptr<StrictMock<DecryptingVideoDecoder> > decoder_;
|
| + scoped_refptr<DecryptingVideoDecoder> decoder_;
|
| scoped_ptr<StrictMock<MockDecryptor> > decryptor_;
|
| scoped_refptr<StrictMock<MockDemuxerStream> > demuxer_;
|
| MockStatisticsCB statistics_cb_;
|
| @@ -355,7 +354,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 +373,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 +401,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 +455,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 +506,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 +590,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.
|
|
|