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

Unified Diff: media/filters/decrypting_video_decoder_unittest.cc

Issue 167333004: Encrypted Media: No need to cancel NewKeyCB during tear down. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments addressed Created 6 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
« no previous file with comments | « media/filters/decrypting_video_decoder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « media/filters/decrypting_video_decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698