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

Unified Diff: media/filters/decrypting_audio_decoder_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_audio_decoder.cc ('k') | media/filters/decrypting_demuxer_stream.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 bd12003503fb6eddf0ea896d095d277ced33f959..830a5a1147901768b40c4f2a6905b715898c00d2 100644
--- a/media/filters/decrypting_audio_decoder_unittest.cc
+++ b/media/filters/decrypting_audio_decoder_unittest.cc
@@ -281,15 +281,6 @@ TEST_F(DecryptingAudioDecoderTest, Initialize_Normal) {
Initialize();
}
-// Ensure that DecryptingAudioDecoder only accepts encrypted audio.
-TEST_F(DecryptingAudioDecoderTest, Initialize_UnencryptedAudioConfig) {
- AudioDecoderConfig config(kCodecVorbis, kSampleFormatPlanarF32,
- CHANNEL_LAYOUT_STEREO, kSampleRate,
- EmptyExtraData(), Unencrypted());
-
- InitializeAndExpectResult(config, false);
-}
-
// Ensure decoder handles invalid audio configs without crashing.
TEST_F(DecryptingAudioDecoderTest, Initialize_InvalidAudioConfig) {
AudioDecoderConfig config(kUnknownAudioCodec, kUnknownSampleFormat,
@@ -368,8 +359,8 @@ TEST_F(DecryptingAudioDecoderTest, DecryptAndDecode_EndOfStream) {
EnterEndOfStreamState();
}
-// Test reinitializing decode with a new config
-TEST_F(DecryptingAudioDecoderTest, Reinitialize_ConfigChange) {
+// Test reinitializing decode with a new encrypted config.
+TEST_F(DecryptingAudioDecoderTest, Reinitialize_EncryptedToEncrypted) {
Initialize();
EXPECT_CALL(*decryptor_, InitializeAudioDecoder(_, _))
@@ -384,6 +375,29 @@ TEST_F(DecryptingAudioDecoderTest, Reinitialize_ConfigChange) {
EXPECT_NE(new_config.bits_per_channel(), config_.bits_per_channel());
EXPECT_NE(new_config.channel_layout(), config_.channel_layout());
EXPECT_NE(new_config.samples_per_second(), config_.samples_per_second());
+ ASSERT_TRUE(new_config.is_encrypted());
+
+ ReinitializeConfigChange(new_config);
+ base::RunLoop().RunUntilIdle();
+}
+
+// Test reinitializing decode with a new clear config.
+TEST_F(DecryptingAudioDecoderTest, Reinitialize_EncryptedToClear) {
+ Initialize();
+
+ EXPECT_CALL(*decryptor_, InitializeAudioDecoder(_, _))
+ .Times(AtMost(1))
+ .WillOnce(RunCallback<1>(true));
+
+ // The new config is different from the initial config in bits-per-channel,
+ // channel layout and samples_per_second.
+ AudioDecoderConfig new_config(kCodecVorbis, kSampleFormatPlanarS16,
+ CHANNEL_LAYOUT_5_1, 88200, EmptyExtraData(),
+ Unencrypted());
+ EXPECT_NE(new_config.bits_per_channel(), config_.bits_per_channel());
+ EXPECT_NE(new_config.channel_layout(), config_.channel_layout());
+ EXPECT_NE(new_config.samples_per_second(), config_.samples_per_second());
+ ASSERT_FALSE(new_config.is_encrypted());
ReinitializeConfigChange(new_config);
base::RunLoop().RunUntilIdle();
« no previous file with comments | « media/filters/decrypting_audio_decoder.cc ('k') | media/filters/decrypting_demuxer_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698