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

Unified Diff: media/filters/decrypting_audio_decoder_unittest.cc

Issue 416333011: Allow setContentDecryptionModule() to get called when setting is done. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: enhance tests Created 6 years, 5 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_audio_decoder_unittest.cc
diff --git a/media/filters/decrypting_audio_decoder_unittest.cc b/media/filters/decrypting_audio_decoder_unittest.cc
index 83d7f5f36bdc9a7fec59aea600c9e2e9538f6953..9b89a3de400ac66b0f2fe2c55baadbbb4e69184c 100644
--- a/media/filters/decrypting_audio_decoder_unittest.cc
+++ b/media/filters/decrypting_audio_decoder_unittest.cc
@@ -20,6 +20,7 @@
using ::testing::_;
using ::testing::AtMost;
+using ::testing::Eq;
using ::testing::SaveArg;
using ::testing::StrictMock;
@@ -54,9 +55,9 @@ ACTION_P(ReturnBuffer, buffer) {
return buffer;
}
-ACTION_P(RunCallbackIfNotNull, param) {
+ACTION_P2(RunCallbackIfNotNull, p1, p2) {
if (!arg0.is_null())
- arg0.Run(param);
+ arg0.Run(p1, p2);
}
} // namespace
@@ -108,7 +109,11 @@ class DecryptingAudioDecoderTest : public testing::Test {
.Times(AtMost(1))
.WillOnce(RunCallback<1>(true));
EXPECT_CALL(*this, RequestDecryptorNotification(_))
- .WillOnce(RunCallbackIfNotNull(decryptor_.get()));
+ .WillOnce(RunCallbackIfNotNull(
+ decryptor_.get(),
+ base::Bind(&DecryptingAudioDecoderTest::DecryptorSet,
+ base::Unretained(this))));
+ EXPECT_CALL(*this, DecryptorSet(Eq(true)));
EXPECT_CALL(*decryptor_, RegisterNewKeyCB(Decryptor::kAudio, _))
.WillOnce(SaveArg<1>(&key_added_cb_));
@@ -248,6 +253,8 @@ class DecryptingAudioDecoderTest : public testing::Test {
MOCK_METHOD1(FrameReady, void(const scoped_refptr<AudioBuffer>&));
MOCK_METHOD1(DecodeDone, void(AudioDecoder::Status));
+ MOCK_METHOD1(DecryptorSet, void(bool));
+
base::MessageLoop message_loop_;
scoped_ptr<DecryptingAudioDecoder> decoder_;
scoped_ptr<StrictMock<MockDecryptor> > decryptor_;
@@ -294,8 +301,11 @@ TEST_F(DecryptingAudioDecoderTest, Initialize_InvalidAudioConfig) {
TEST_F(DecryptingAudioDecoderTest, Initialize_UnsupportedAudioConfig) {
EXPECT_CALL(*decryptor_, InitializeAudioDecoder(_, _))
.WillOnce(RunCallback<1>(false));
- EXPECT_CALL(*this, RequestDecryptorNotification(_))
- .WillOnce(RunCallbackIfNotNull(decryptor_.get()));
+ EXPECT_CALL(*this, RequestDecryptorNotification(_)).WillOnce(
+ RunCallbackIfNotNull(decryptor_.get(),
+ base::Bind(&DecryptingAudioDecoderTest::DecryptorSet,
+ base::Unretained(this))));
+ EXPECT_CALL(*this, DecryptorSet(Eq(true)));
ddorwin 2014/08/04 18:59:08 In the unsupported audio config case, do we actual
jrummell 2014/08/07 01:54:25 SetDecryptor() calls the cb with true as long as d
AudioDecoderConfig config(kCodecVorbis, kSampleFormatPlanarF32,
CHANNEL_LAYOUT_STEREO, kSampleRate, NULL, 0, true);
@@ -303,8 +313,11 @@ TEST_F(DecryptingAudioDecoderTest, Initialize_UnsupportedAudioConfig) {
}
TEST_F(DecryptingAudioDecoderTest, Initialize_NullDecryptor) {
- EXPECT_CALL(*this, RequestDecryptorNotification(_))
- .WillRepeatedly(RunCallbackIfNotNull(static_cast<Decryptor*>(NULL)));
+ EXPECT_CALL(*this, RequestDecryptorNotification(_)).WillRepeatedly(
+ RunCallbackIfNotNull(static_cast<Decryptor*>(NULL),
+ base::Bind(&DecryptingAudioDecoderTest::DecryptorSet,
+ base::Unretained(this))));
+ EXPECT_CALL(*this, DecryptorSet(Eq(false)));
AudioDecoderConfig config(kCodecVorbis, kSampleFormatPlanarF32,
CHANNEL_LAYOUT_STEREO, kSampleRate, NULL, 0, true);

Powered by Google App Engine
This is Rietveld 408576698