Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Unified Diff: media/filters/decrypting_video_decoder_unittest.cc

Issue 935243002: Decryptors can report kNoKey to WebMediaPlayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 11dc52ae7a0be4c7f3ca84f3c9da51fa8c9b1865..0ab79dfdb98e92d5e8246ad1cf9f16ddb5db4843 100644
--- a/media/filters/decrypting_video_decoder_unittest.cc
+++ b/media/filters/decrypting_video_decoder_unittest.cc
@@ -83,9 +83,12 @@ class DecryptingVideoDecoderTest : public testing::Test {
// can succeed or fail.
void InitializeAndExpectStatus(const VideoDecoderConfig& config,
PipelineStatus status) {
- decoder_->Initialize(config, false, NewExpectedStatusCB(status),
- base::Bind(&DecryptingVideoDecoderTest::FrameReady,
- base::Unretained(this)));
+ decoder_->Initialize(
+ config, false, NewExpectedStatusCB(status),
+ base::Bind(&DecryptingVideoDecoderTest::FrameReady,
+ base::Unretained(this)),
+ base::Bind(&DecryptingVideoDecoderTest::OnWaitingForEncryptionKey,
+ base::Unretained(this)));
message_loop_.RunUntilIdle();
}
@@ -179,6 +182,7 @@ class DecryptingVideoDecoderTest : public testing::Test {
void EnterWaitingForKeyState() {
EXPECT_CALL(*decryptor_, DecryptAndDecodeVideo(_, _))
.WillRepeatedly(RunCallback<1>(Decryptor::kNoKey, null_video_frame_));
+ EXPECT_CALL(*this, OnWaitingForEncryptionKey());
decoder_->Decode(encrypted_buffer_,
base::Bind(&DecryptingVideoDecoderTest::DecodeDone,
base::Unretained(this)));
@@ -227,6 +231,8 @@ class DecryptingVideoDecoderTest : public testing::Test {
MOCK_METHOD1(DecryptorSet, void(bool));
+ MOCK_METHOD0(OnWaitingForEncryptionKey, void(void));
+
base::MessageLoop message_loop_;
scoped_ptr<DecryptingVideoDecoder> decoder_;
scoped_ptr<StrictMock<MockDecryptor> > decryptor_;
@@ -263,6 +269,7 @@ TEST_F(DecryptingVideoDecoderTest, Initialize_Failure) {
.WillRepeatedly(RunCallback<1>(false));
EXPECT_CALL(*decryptor_, RegisterNewKeyCB(Decryptor::kVideo, _))
.WillRepeatedly(SaveArg<1>(&key_added_cb_));
+ EXPECT_CALL(*this, RequestDecryptorNotification(_)).Times(2);
InitializeAndExpectStatus(TestVideoConfig::NormalEncrypted(),
DECODER_ERROR_NOT_SUPPORTED);
@@ -333,7 +340,7 @@ TEST_F(DecryptingVideoDecoderTest, KeyAdded_DuringWaitingForKey) {
// Test the case where the a key is added when the decryptor is in
// kPendingDecode state.
-TEST_F(DecryptingVideoDecoderTest, KeyAdded_DruingPendingDecode) {
+TEST_F(DecryptingVideoDecoderTest, KeyAdded_DuringPendingDecode) {
Initialize();
EnterPendingDecodeState();
@@ -407,11 +414,13 @@ TEST_F(DecryptingVideoDecoderTest, Destroy_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),
- base::Bind(&DecryptingVideoDecoderTest::FrameReady,
- base::Unretained(this)));
+ decoder_->Initialize(
+ TestVideoConfig::NormalEncrypted(), false,
+ NewExpectedStatusCB(DECODER_ERROR_NOT_SUPPORTED),
+ base::Bind(&DecryptingVideoDecoderTest::FrameReady,
+ base::Unretained(this)),
+ base::Bind(&DecryptingVideoDecoderTest::OnWaitingForEncryptionKey,
+ base::Unretained(this)));
message_loop_.RunUntilIdle();
// |decryptor_ready_cb| is saved but not called here.
EXPECT_FALSE(decryptor_ready_cb.is_null());

Powered by Google App Engine
This is Rietveld 408576698