| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "media/base/encryption_scheme.h" |
| 9 #include "media/base/gmock_callback_support.h" | 10 #include "media/base/gmock_callback_support.h" |
| 10 #include "media/base/media_util.h" | 11 #include "media/base/media_util.h" |
| 11 #include "media/base/mock_filters.h" | 12 #include "media/base/mock_filters.h" |
| 12 #include "media/base/test_helpers.h" | 13 #include "media/base/test_helpers.h" |
| 13 #include "media/filters/decoder_selector.h" | 14 #include "media/filters/decoder_selector.h" |
| 14 #include "media/filters/decrypting_demuxer_stream.h" | 15 #include "media/filters/decrypting_demuxer_stream.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 17 |
| 17 using ::testing::_; | 18 using ::testing::_; |
| 18 using ::testing::InvokeWithoutArgs; | 19 using ::testing::InvokeWithoutArgs; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 void UseClearStream() { | 89 void UseClearStream() { |
| 89 AudioDecoderConfig clear_audio_config(kCodecVorbis, kSampleFormatPlanarF32, | 90 AudioDecoderConfig clear_audio_config(kCodecVorbis, kSampleFormatPlanarF32, |
| 90 CHANNEL_LAYOUT_STEREO, 44100, | 91 CHANNEL_LAYOUT_STEREO, 44100, |
| 91 EmptyExtraData(), false); | 92 EmptyExtraData(), false); |
| 92 demuxer_stream_->set_audio_decoder_config(clear_audio_config); | 93 demuxer_stream_->set_audio_decoder_config(clear_audio_config); |
| 93 } | 94 } |
| 94 | 95 |
| 95 void UseEncryptedStream() { | 96 void UseEncryptedStream() { |
| 96 AudioDecoderConfig encrypted_audio_config( | 97 AudioDecoderConfig encrypted_audio_config( |
| 97 kCodecVorbis, kSampleFormatPlanarF32, CHANNEL_LAYOUT_STEREO, 44100, | 98 kCodecVorbis, kSampleFormatPlanarF32, CHANNEL_LAYOUT_STEREO, 44100, |
| 98 EmptyExtraData(), true); | 99 EmptyExtraData(), EncryptionScheme(true)); |
| 99 demuxer_stream_->set_audio_decoder_config(encrypted_audio_config); | 100 demuxer_stream_->set_audio_decoder_config(encrypted_audio_config); |
| 100 } | 101 } |
| 101 | 102 |
| 102 void InitializeDecoderSelector(DecryptorCapability decryptor_capability, | 103 void InitializeDecoderSelector(DecryptorCapability decryptor_capability, |
| 103 int num_decoders) { | 104 int num_decoders) { |
| 104 if (decryptor_capability == kDecryptOnly || | 105 if (decryptor_capability == kDecryptOnly || |
| 105 decryptor_capability == kDecryptAndDecode) { | 106 decryptor_capability == kDecryptAndDecode) { |
| 106 EXPECT_CALL(*cdm_context_, GetDecryptor()) | 107 EXPECT_CALL(*cdm_context_, GetDecryptor()) |
| 107 .WillRepeatedly(Return(decryptor_.get())); | 108 .WillRepeatedly(Return(decryptor_.get())); |
| 108 | 109 |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 } | 418 } |
| 418 | 419 |
| 419 TEST_F(AudioDecoderSelectorTest, Destroy_EncryptedStream_DecryptAndDecode) { | 420 TEST_F(AudioDecoderSelectorTest, Destroy_EncryptedStream_DecryptAndDecode) { |
| 420 UseEncryptedStream(); | 421 UseEncryptedStream(); |
| 421 InitializeDecoderSelector(kHoldSetDecryptor, 1); | 422 InitializeDecoderSelector(kHoldSetDecryptor, 1); |
| 422 | 423 |
| 423 SelectDecoderAndDestroy(); | 424 SelectDecoderAndDestroy(); |
| 424 } | 425 } |
| 425 | 426 |
| 426 } // namespace media | 427 } // namespace media |
| OLD | NEW |