Index: media/filters/ffmpeg_video_decoder_unittest.cc |
diff --git a/media/filters/ffmpeg_video_decoder_unittest.cc b/media/filters/ffmpeg_video_decoder_unittest.cc |
index f720cf166fbe6a81f101ff1740d0ab882affe2bf..a975d9f55bac0aff5ef4feb8dbce9fe1c4c3cd74 100644 |
--- a/media/filters/ffmpeg_video_decoder_unittest.cc |
+++ b/media/filters/ffmpeg_video_decoder_unittest.cc |
@@ -432,6 +432,28 @@ TEST_F(FFmpegVideoDecoderTest, DecodeEncryptedFrame_DecryptError) { |
message_loop_.RunAllPending(); |
} |
+// Test the case that the decryptor has no key to decrypt the encrypted buffer. |
+TEST_F(FFmpegVideoDecoderTest, DecodeEncryptedFrame_NoDecryptionKey) { |
+ Initialize(); |
+ |
+ // Simulate decoding a single encrypted frame. |
+ EXPECT_CALL(*demuxer_, Read(_)) |
+ .WillRepeatedly(ReturnBuffer(encrypted_i_frame_buffer_)); |
+ EXPECT_CALL(*decryptor_, Decrypt(encrypted_i_frame_buffer_, _)) |
+ .WillRepeatedly(RunDecryptCB(Decryptor::kNoKey, |
+ scoped_refptr<media::DecoderBuffer>())); |
+ |
+ // Our read should still get satisfied with end of stream frame during an |
+ // error. |
+ VideoDecoder::DecoderStatus status; |
+ scoped_refptr<VideoFrame> video_frame; |
+ Read(&status, &video_frame); |
+ EXPECT_EQ(VideoDecoder::kDecryptError, status); |
+ EXPECT_FALSE(video_frame); |
+ |
+ message_loop_.RunAllPending(); |
+} |
+ |
// Test the case that the decryptor fails to decrypt the encrypted buffer but |
// cannot detect the decryption error and returns a corrupted buffer. |
TEST_F(FFmpegVideoDecoderTest, DecodeEncryptedFrame_CorruptedBufferReturned) { |