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 04b073fa8fdd42f7d6ba3c8653c8c6d44c9128ca..a01c8c06b0be4d6b0e8e789964b7176c82f4fa25 100644 |
--- a/media/filters/decrypting_video_decoder_unittest.cc |
+++ b/media/filters/decrypting_video_decoder_unittest.cc |
@@ -82,23 +82,32 @@ class DecryptingVideoDecoderTest : public testing::Test { |
Stop(); |
} |
+ // Initializes the |decoder_| and expects |status|. Note the initialization |
+ // can succeed or fail. |
void InitializeAndExpectStatus(const VideoDecoderConfig& config, |
PipelineStatus status) { |
decoder_->Initialize(config, NewExpectedStatusCB(status)); |
message_loop_.RunUntilIdle(); |
} |
+ // Initialize the |decoder_| and expects it to succeed. |
void Initialize() { |
EXPECT_CALL(*decryptor_, InitializeVideoDecoder(_, _)) |
- .WillRepeatedly(RunCallback<1>(true)); |
+ .WillOnce(RunCallback<1>(true)); |
EXPECT_CALL(*decryptor_, RegisterNewKeyCB(Decryptor::kVideo, _)) |
- .WillRepeatedly(SaveArg<1>(&key_added_cb_)); |
+ .WillOnce(SaveArg<1>(&key_added_cb_)); |
InitializeAndExpectStatus(TestVideoConfig::NormalEncrypted(), PIPELINE_OK); |
} |
+ // Reinitialize the |decoder_| and expects it to succeed. |
void Reinitialize() { |
EXPECT_CALL(*decryptor_, DeinitializeDecoder(Decryptor::kVideo)); |
+ EXPECT_CALL(*decryptor_, InitializeVideoDecoder(_, _)) |
+ .WillOnce(RunCallback<1>(true)); |
+ EXPECT_CALL(*decryptor_, RegisterNewKeyCB(Decryptor::kVideo, _)) |
+ .WillOnce(SaveArg<1>(&key_added_cb_)); |
+ |
InitializeAndExpectStatus(TestVideoConfig::LargeEncrypted(), PIPELINE_OK); |
} |
@@ -190,9 +199,6 @@ class DecryptingVideoDecoderTest : public testing::Test { |
} |
void Stop() { |
- EXPECT_CALL(*decryptor_, RegisterNewKeyCB(Decryptor::kVideo, |
- IsNullCallback())) |
- .Times(AtMost(1)); |
EXPECT_CALL(*decryptor_, DeinitializeDecoder(Decryptor::kVideo)) |
.WillRepeatedly(InvokeWithoutArgs( |
this, &DecryptingVideoDecoderTest::AbortAllPendingCBs)); |
@@ -259,6 +265,8 @@ TEST_F(DecryptingVideoDecoderTest, Reinitialize_Failure) { |
EXPECT_CALL(*decryptor_, InitializeVideoDecoder(_, _)) |
.WillOnce(RunCallback<1>(false)); |
+ // Reinitialize() expects the reinitialization to succeed. Call |
+ // InitializeAndExpectStatus() directly to test the reinitialization failure. |
InitializeAndExpectStatus(TestVideoConfig::NormalEncrypted(), |
DECODER_ERROR_NOT_SUPPORTED); |
} |