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

Unified Diff: media/filters/decrypting_demuxer_stream_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: rebase + android tweaks Created 6 years, 4 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_demuxer_stream.cc ('k') | media/filters/decrypting_video_decoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/decrypting_demuxer_stream_unittest.cc
diff --git a/media/filters/decrypting_demuxer_stream_unittest.cc b/media/filters/decrypting_demuxer_stream_unittest.cc
index fec56248e0bc97e5063ed3b8eaa244e3e0b8a584..fa2a36cf947a69408c06dced673665c4fa41ff18 100644
--- a/media/filters/decrypting_demuxer_stream_unittest.cc
+++ b/media/filters/decrypting_demuxer_stream_unittest.cc
@@ -53,9 +53,9 @@ ACTION_P(ReturnBuffer, buffer) {
// Sets the |decryptor| if the DecryptorReadyCB (arg0) is not null. Sets
// |is_decryptor_set| to true if a non-NULL |decryptor| has been set through the
// callback.
-ACTION_P2(SetDecryptorIfNotNull, decryptor, is_decryptor_set) {
+ACTION_P3(SetDecryptorIfNotNull, decryptor, done_cb, is_decryptor_set) {
if (!arg0.is_null())
- arg0.Run(decryptor);
+ arg0.Run(decryptor, done_cb);
*is_decryptor_set = !arg0.is_null() && decryptor;
}
@@ -112,14 +112,23 @@ class DecryptingDemuxerStreamTest : public testing::Test {
message_loop_.RunUntilIdle();
}
+ void ExpectDecryptorNotification(Decryptor* decryptor, bool expected_result) {
+ EXPECT_CALL(*this, RequestDecryptorNotification(_))
+ .WillOnce(SetDecryptorIfNotNull(
+ decryptor,
+ base::Bind(&DecryptingDemuxerStreamTest::DecryptorSet,
+ base::Unretained(this)),
+ &is_decryptor_set_));
+ EXPECT_CALL(*this, DecryptorSet(expected_result));
+ }
+
// The following functions are used to test stream-type-neutral logic in
// DecryptingDemuxerStream. Therefore, we don't specify audio or video in the
// function names. But for testing purpose, they all use an audio input
// demuxer stream.
void Initialize() {
- EXPECT_CALL(*this, RequestDecryptorNotification(_))
- .WillOnce(SetDecryptorIfNotNull(decryptor_.get(), &is_decryptor_set_));
+ ExpectDecryptorNotification(decryptor_.get(), true);
EXPECT_CALL(*decryptor_, RegisterNewKeyCB(Decryptor::kAudio, _))
.WillOnce(SaveArg<1>(&key_added_cb_));
@@ -249,6 +258,8 @@ class DecryptingDemuxerStreamTest : public testing::Test {
MOCK_METHOD2(BufferReady, void(DemuxerStream::Status,
const scoped_refptr<DecoderBuffer>&));
+ MOCK_METHOD1(DecryptorSet, void(bool));
+
base::MessageLoop message_loop_;
scoped_ptr<DecryptingDemuxerStream> demuxer_stream_;
scoped_ptr<StrictMock<MockDecryptor> > decryptor_;
@@ -276,8 +287,7 @@ TEST_F(DecryptingDemuxerStreamTest, Initialize_NormalAudio) {
}
TEST_F(DecryptingDemuxerStreamTest, Initialize_NormalVideo) {
- EXPECT_CALL(*this, RequestDecryptorNotification(_))
- .WillOnce(SetDecryptorIfNotNull(decryptor_.get(), &is_decryptor_set_));
+ ExpectDecryptorNotification(decryptor_.get(), true);
EXPECT_CALL(*decryptor_, RegisterNewKeyCB(Decryptor::kVideo, _))
.WillOnce(SaveArg<1>(&key_added_cb_));
@@ -303,10 +313,7 @@ TEST_F(DecryptingDemuxerStreamTest, Initialize_NormalVideo) {
}
TEST_F(DecryptingDemuxerStreamTest, Initialize_NullDecryptor) {
- EXPECT_CALL(*this, RequestDecryptorNotification(_))
- .WillRepeatedly(SetDecryptorIfNotNull(static_cast<Decryptor*>(NULL),
- &is_decryptor_set_));
-
+ ExpectDecryptorNotification(NULL, false);
AudioDecoderConfig input_config(kCodecVorbis, kSampleFormatPlanarF32,
CHANNEL_LAYOUT_STEREO, 44100, NULL, 0, true);
InitializeAudioAndExpectStatus(input_config, DECODER_ERROR_NOT_SUPPORTED);
« no previous file with comments | « media/filters/decrypting_demuxer_stream.cc ('k') | media/filters/decrypting_video_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698