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

Unified Diff: media/filters/decrypting_demuxer_stream_unittest.cc

Issue 2543623003: media: Allow config change between clear and encrypted streams (Closed)
Patch Set: comments addressed Created 3 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_demuxer_stream.cc ('k') | media/filters/decrypting_video_decoder.cc » ('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 d13aec42f0a17f8bb10df53acae7d9f06833b123..e6a57e2dc27402b5dd83f0113cf82dc408e43faf 100644
--- a/media/filters/decrypting_demuxer_stream_unittest.cc
+++ b/media/filters/decrypting_demuxer_stream_unittest.cc
@@ -72,7 +72,8 @@ class DecryptingDemuxerStreamTest : public testing::Test {
new StrictMock<MockDemuxerStream>(DemuxerStream::AUDIO)),
input_video_stream_(
new StrictMock<MockDemuxerStream>(DemuxerStream::VIDEO)),
- clear_buffer_(CreateFakeEncryptedStreamBuffer(true)),
+ clear_buffer_(new DecoderBuffer(kFakeBufferSize)),
+ clear_encrypted_stream_buffer_(CreateFakeEncryptedStreamBuffer(true)),
encrypted_buffer_(CreateFakeEncryptedStreamBuffer(false)),
decrypted_buffer_(new DecoderBuffer(kFakeBufferSize)) {}
@@ -158,10 +159,12 @@ class DecryptingDemuxerStreamTest : public testing::Test {
base::RunLoop().RunUntilIdle();
}
- void EnterClearReadingState() {
- EXPECT_TRUE(clear_buffer_->decrypt_config());
+ void EnterClearReadingState(bool is_stream_encrytped) {
+ EXPECT_TRUE(clear_encrypted_stream_buffer_->decrypt_config());
EXPECT_CALL(*input_audio_stream_, Read(_))
- .WillOnce(ReturnBuffer(clear_buffer_));
+ .WillOnce(ReturnBuffer(is_stream_encrytped
+ ? clear_encrypted_stream_buffer_
+ : clear_buffer_));
// For clearbuffer, decryptor->Decrypt() will not be called.
@@ -266,6 +269,7 @@ class DecryptingDemuxerStreamTest : public testing::Test {
// Constant buffers to be returned by the input demuxer streams and the
// |decryptor_|.
scoped_refptr<DecoderBuffer> clear_buffer_;
+ scoped_refptr<DecoderBuffer> clear_encrypted_stream_buffer_;
scoped_refptr<DecoderBuffer> encrypted_buffer_;
scoped_refptr<DecoderBuffer> decrypted_buffer_;
@@ -313,9 +317,17 @@ TEST_F(DecryptingDemuxerStreamTest, Read_Normal) {
}
// Test normal read case where the buffer is clear.
-TEST_F(DecryptingDemuxerStreamTest, Read_Clear) {
+// TODO(xhwang): Unify clear buffer handling in clear and encrypted stream.
+// See http://crbug.com/675003
+
+TEST_F(DecryptingDemuxerStreamTest, Read_ClearBufferInEncryptedStream) {
+ Initialize();
+ EnterClearReadingState(true);
+}
+
+TEST_F(DecryptingDemuxerStreamTest, Read_ClearBufferInClearStream) {
Initialize();
- EnterClearReadingState();
+ EnterClearReadingState(false);
}
// Test the case where the decryptor returns error during read.
« no previous file with comments | « media/filters/decrypting_demuxer_stream.cc ('k') | media/filters/decrypting_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698