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 23270f391305ffc37c0997069c1a4e3c80aad751..b0b05f457aaae5a7b62c007f8a36cd28a93e3f1a 100644 |
--- a/media/filters/decrypting_video_decoder_unittest.cc |
+++ b/media/filters/decrypting_video_decoder_unittest.cc |
@@ -86,7 +86,9 @@ class DecryptingVideoDecoderTest : public testing::Test { |
// can succeed or fail. |
void InitializeAndExpectStatus(const VideoDecoderConfig& config, |
PipelineStatus status) { |
- decoder_->Initialize(config, false, NewExpectedStatusCB(status)); |
+ decoder_->Initialize(config, false, NewExpectedStatusCB(status), |
+ base::Bind(&DecryptingVideoDecoderTest::FrameReady, |
+ base::Unretained(this))); |
message_loop_.RunUntilIdle(); |
} |
@@ -115,15 +117,17 @@ class DecryptingVideoDecoderTest : public testing::Test { |
const scoped_refptr<DecoderBuffer>& buffer, |
VideoDecoder::Status status, |
const scoped_refptr<VideoFrame>& video_frame) { |
- if (status != VideoDecoder::kOk) |
- EXPECT_CALL(*this, FrameReady(status, IsNull())); |
- else if (video_frame.get() && video_frame->end_of_stream()) |
- EXPECT_CALL(*this, FrameReady(status, IsEndOfStream())); |
- else |
- EXPECT_CALL(*this, FrameReady(status, video_frame)); |
+ if (video_frame.get()) { |
+ if (video_frame->end_of_stream()) { |
+ EXPECT_CALL(*this, FrameReady(IsEndOfStream())); |
+ } else { |
+ EXPECT_CALL(*this, FrameReady(video_frame)); |
+ } |
+ } |
+ EXPECT_CALL(*this, DecodeDone(status)); |
decoder_->Decode(buffer, |
- base::Bind(&DecryptingVideoDecoderTest::FrameReady, |
+ base::Bind(&DecryptingVideoDecoderTest::DecodeDone, |
base::Unretained(this))); |
message_loop_.RunUntilIdle(); |
} |
@@ -155,7 +159,7 @@ class DecryptingVideoDecoderTest : public testing::Test { |
.WillOnce(SaveArg<1>(&pending_video_decode_cb_)); |
decoder_->Decode(encrypted_buffer_, |
- base::Bind(&DecryptingVideoDecoderTest::FrameReady, |
+ base::Bind(&DecryptingVideoDecoderTest::DecodeDone, |
base::Unretained(this))); |
message_loop_.RunUntilIdle(); |
// Make sure the Decode() on the decoder triggers a DecryptAndDecode() on |
@@ -167,7 +171,7 @@ class DecryptingVideoDecoderTest : public testing::Test { |
EXPECT_CALL(*decryptor_, DecryptAndDecodeVideo(_, _)) |
.WillRepeatedly(RunCallback<1>(Decryptor::kNoKey, null_video_frame_)); |
decoder_->Decode(encrypted_buffer_, |
- base::Bind(&DecryptingVideoDecoderTest::FrameReady, |
+ base::Bind(&DecryptingVideoDecoderTest::DecodeDone, |
base::Unretained(this))); |
message_loop_.RunUntilIdle(); |
} |
@@ -209,8 +213,8 @@ class DecryptingVideoDecoderTest : public testing::Test { |
MOCK_METHOD1(RequestDecryptorNotification, void(const DecryptorReadyCB&)); |
- MOCK_METHOD2(FrameReady, void(VideoDecoder::Status, |
- const scoped_refptr<VideoFrame>&)); |
+ MOCK_METHOD1(FrameReady, void(const scoped_refptr<VideoFrame>&)); |
+ MOCK_METHOD1(DecodeDone, void(VideoDecoder::Status)); |
base::MessageLoop message_loop_; |
scoped_ptr<DecryptingVideoDecoder> decoder_; |
@@ -306,7 +310,7 @@ TEST_F(DecryptingVideoDecoderTest, DecryptAndDecode_NeedMoreData) { |
decoded_video_frame_)); |
ReadAndExpectFrameReadyWith( |
- encrypted_buffer_, VideoDecoder::kNotEnoughData, decoded_video_frame_); |
+ encrypted_buffer_, VideoDecoder::kOk, NULL); |
ReadAndExpectFrameReadyWith( |
encrypted_buffer_, VideoDecoder::kOk, decoded_video_frame_); |
} |
@@ -327,7 +331,8 @@ TEST_F(DecryptingVideoDecoderTest, KeyAdded_DuringWaitingForKey) { |
EXPECT_CALL(*decryptor_, DecryptAndDecodeVideo(_, _)) |
.WillRepeatedly(RunCallback<1>(Decryptor::kSuccess, |
decoded_video_frame_)); |
- EXPECT_CALL(*this, FrameReady(VideoDecoder::kOk, decoded_video_frame_)); |
+ EXPECT_CALL(*this, FrameReady(decoded_video_frame_)); |
+ EXPECT_CALL(*this, DecodeDone(VideoDecoder::kOk)); |
key_added_cb_.Run(); |
message_loop_.RunUntilIdle(); |
} |
@@ -341,7 +346,8 @@ TEST_F(DecryptingVideoDecoderTest, KeyAdded_DruingPendingDecode) { |
EXPECT_CALL(*decryptor_, DecryptAndDecodeVideo(_, _)) |
.WillRepeatedly(RunCallback<1>(Decryptor::kSuccess, |
decoded_video_frame_)); |
- EXPECT_CALL(*this, FrameReady(VideoDecoder::kOk, decoded_video_frame_)); |
+ EXPECT_CALL(*this, FrameReady(decoded_video_frame_)); |
+ EXPECT_CALL(*this, DecodeDone(VideoDecoder::kOk)); |
// The video decode callback is returned after the correct decryption key is |
// added. |
key_added_cb_.Run(); |
@@ -370,7 +376,7 @@ TEST_F(DecryptingVideoDecoderTest, Reset_DuringPendingDecode) { |
Initialize(); |
EnterPendingDecodeState(); |
- EXPECT_CALL(*this, FrameReady(VideoDecoder::kAborted, IsNull())); |
+ EXPECT_CALL(*this, DecodeDone(VideoDecoder::kAborted)); |
Reset(); |
} |
@@ -380,7 +386,7 @@ TEST_F(DecryptingVideoDecoderTest, Reset_DuringWaitingForKey) { |
Initialize(); |
EnterWaitingForKeyState(); |
- EXPECT_CALL(*this, FrameReady(VideoDecoder::kAborted, IsNull())); |
+ EXPECT_CALL(*this, DecodeDone(VideoDecoder::kAborted)); |
Reset(); |
} |
@@ -407,8 +413,11 @@ TEST_F(DecryptingVideoDecoderTest, Stop_DuringDecryptorRequested) { |
DecryptorReadyCB decryptor_ready_cb; |
EXPECT_CALL(*this, RequestDecryptorNotification(_)) |
.WillOnce(SaveArg<0>(&decryptor_ready_cb)); |
- decoder_->Initialize(TestVideoConfig::NormalEncrypted(), false, |
- NewExpectedStatusCB(DECODER_ERROR_NOT_SUPPORTED)); |
+ decoder_->Initialize(TestVideoConfig::NormalEncrypted(), |
+ false, |
+ NewExpectedStatusCB(DECODER_ERROR_NOT_SUPPORTED), |
+ base::Bind(&DecryptingVideoDecoderTest::FrameReady, |
+ base::Unretained(this))); |
message_loop_.RunUntilIdle(); |
// |decryptor_ready_cb| is saved but not called here. |
EXPECT_FALSE(decryptor_ready_cb.is_null()); |
@@ -453,7 +462,7 @@ TEST_F(DecryptingVideoDecoderTest, Stop_DuringPendingDecode) { |
Initialize(); |
EnterPendingDecodeState(); |
- EXPECT_CALL(*this, FrameReady(VideoDecoder::kAborted, IsNull())); |
+ EXPECT_CALL(*this, DecodeDone(VideoDecoder::kAborted)); |
Stop(); |
} |
@@ -463,7 +472,7 @@ TEST_F(DecryptingVideoDecoderTest, Stop_DuringWaitingForKey) { |
Initialize(); |
EnterWaitingForKeyState(); |
- EXPECT_CALL(*this, FrameReady(VideoDecoder::kAborted, IsNull())); |
+ EXPECT_CALL(*this, DecodeDone(VideoDecoder::kAborted)); |
Stop(); |
} |
@@ -485,7 +494,7 @@ TEST_F(DecryptingVideoDecoderTest, Stop_DuringPendingReset) { |
EnterPendingDecodeState(); |
EXPECT_CALL(*decryptor_, ResetDecoder(Decryptor::kVideo)); |
- EXPECT_CALL(*this, FrameReady(VideoDecoder::kAborted, IsNull())); |
+ EXPECT_CALL(*this, DecodeDone(VideoDecoder::kAborted)); |
decoder_->Reset(NewExpectedClosure()); |
Stop(); |