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

Side by Side Diff: media/filters/audio_decoder_selector_unittest.cc

Issue 1490613005: media config: expand is_encrypted to a struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mojo changes; Message->base::Pickle Created 4 years, 9 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 unified diff | Download patch
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 #include <utility> 6 #include <utility>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "media/base/encryption_scheme.h"
13 #include "media/base/gmock_callback_support.h" 14 #include "media/base/gmock_callback_support.h"
14 #include "media/base/media_util.h" 15 #include "media/base/media_util.h"
15 #include "media/base/mock_filters.h" 16 #include "media/base/mock_filters.h"
16 #include "media/base/test_helpers.h" 17 #include "media/base/test_helpers.h"
17 #include "media/filters/decoder_selector.h" 18 #include "media/filters/decoder_selector.h"
18 #include "media/filters/decrypting_demuxer_stream.h" 19 #include "media/filters/decrypting_demuxer_stream.h"
19 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
20 21
21 using ::testing::_; 22 using ::testing::_;
22 using ::testing::InvokeWithoutArgs; 23 using ::testing::InvokeWithoutArgs;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 MOCK_METHOD2(OnDecoderSelected, 69 MOCK_METHOD2(OnDecoderSelected,
69 void(AudioDecoder*, DecryptingDemuxerStream*)); 70 void(AudioDecoder*, DecryptingDemuxerStream*));
70 71
71 void MockOnDecoderSelected(scoped_ptr<AudioDecoder> decoder, 72 void MockOnDecoderSelected(scoped_ptr<AudioDecoder> decoder,
72 scoped_ptr<DecryptingDemuxerStream> stream) { 73 scoped_ptr<DecryptingDemuxerStream> stream) {
73 OnDecoderSelected(decoder.get(), stream.get()); 74 OnDecoderSelected(decoder.get(), stream.get());
74 selected_decoder_ = std::move(decoder); 75 selected_decoder_ = std::move(decoder);
75 } 76 }
76 77
77 void UseClearStream() { 78 void UseClearStream() {
78 AudioDecoderConfig clear_audio_config(kCodecVorbis, kSampleFormatPlanarF32, 79 AudioDecoderConfig clear_audio_config(
79 CHANNEL_LAYOUT_STEREO, 44100, 80 kCodecVorbis, kSampleFormatPlanarF32, CHANNEL_LAYOUT_STEREO, 44100,
80 EmptyExtraData(), false); 81 EmptyExtraData(), EncryptionScheme::unencrypted());
81 demuxer_stream_->set_audio_decoder_config(clear_audio_config); 82 demuxer_stream_->set_audio_decoder_config(clear_audio_config);
82 } 83 }
83 84
84 void UseEncryptedStream() { 85 void UseEncryptedStream() {
85 AudioDecoderConfig encrypted_audio_config( 86 AudioDecoderConfig encrypted_audio_config(
86 kCodecVorbis, kSampleFormatPlanarF32, CHANNEL_LAYOUT_STEREO, 44100, 87 kCodecVorbis, kSampleFormatPlanarF32, CHANNEL_LAYOUT_STEREO, 44100,
87 EmptyExtraData(), true); 88 EmptyExtraData(), EncryptionScheme(true));
88 demuxer_stream_->set_audio_decoder_config(encrypted_audio_config); 89 demuxer_stream_->set_audio_decoder_config(encrypted_audio_config);
89 } 90 }
90 91
91 void InitializeDecoderSelector(DecryptorCapability decryptor_capability, 92 void InitializeDecoderSelector(DecryptorCapability decryptor_capability,
92 int num_decoders) { 93 int num_decoders) {
93 if (decryptor_capability != kNoCdm) { 94 if (decryptor_capability != kNoCdm) {
94 cdm_context_.reset(new StrictMock<MockCdmContext>()); 95 cdm_context_.reset(new StrictMock<MockCdmContext>());
95 96
96 if (decryptor_capability == kNoDecryptor) { 97 if (decryptor_capability == kNoDecryptor) {
97 EXPECT_CALL(*cdm_context_, GetDecryptor()) 98 EXPECT_CALL(*cdm_context_, GetDecryptor())
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 // initialized and returned. 377 // initialized and returned.
377 EXPECT_CALL(*decoder_1_, Initialize(ClearConfig(), _, _, _)) 378 EXPECT_CALL(*decoder_1_, Initialize(ClearConfig(), _, _, _))
378 .WillOnce(RunCallback<2>(true)); 379 .WillOnce(RunCallback<2>(true));
379 EXPECT_CALL(*this, OnDecoderSelected(NotNull(), NotNull())); 380 EXPECT_CALL(*this, OnDecoderSelected(NotNull(), NotNull()));
380 #endif 381 #endif
381 382
382 SelectDecoder(); 383 SelectDecoder();
383 } 384 }
384 385
385 } // namespace media 386 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698