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 <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" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // InitializeDecoderSelector(). | 61 // InitializeDecoderSelector(). |
62 } | 62 } |
63 | 63 |
64 ~AudioDecoderSelectorTest() { | 64 ~AudioDecoderSelectorTest() { |
65 message_loop_.RunUntilIdle(); | 65 message_loop_.RunUntilIdle(); |
66 } | 66 } |
67 | 67 |
68 MOCK_METHOD2(OnDecoderSelected, | 68 MOCK_METHOD2(OnDecoderSelected, |
69 void(AudioDecoder*, DecryptingDemuxerStream*)); | 69 void(AudioDecoder*, DecryptingDemuxerStream*)); |
70 | 70 |
71 void MockOnDecoderSelected(scoped_ptr<AudioDecoder> decoder, | 71 void MockOnDecoderSelected(std::unique_ptr<AudioDecoder> decoder, |
72 scoped_ptr<DecryptingDemuxerStream> stream) { | 72 std::unique_ptr<DecryptingDemuxerStream> stream) { |
73 OnDecoderSelected(decoder.get(), stream.get()); | 73 OnDecoderSelected(decoder.get(), stream.get()); |
74 selected_decoder_ = std::move(decoder); | 74 selected_decoder_ = std::move(decoder); |
75 } | 75 } |
76 | 76 |
77 void UseClearStream() { | 77 void UseClearStream() { |
78 AudioDecoderConfig clear_audio_config(kCodecVorbis, kSampleFormatPlanarF32, | 78 AudioDecoderConfig clear_audio_config(kCodecVorbis, kSampleFormatPlanarF32, |
79 CHANNEL_LAYOUT_STEREO, 44100, | 79 CHANNEL_LAYOUT_STEREO, 44100, |
80 EmptyExtraData(), Unencrypted()); | 80 EmptyExtraData(), Unencrypted()); |
81 demuxer_stream_->set_audio_decoder_config(clear_audio_config); | 81 demuxer_stream_->set_audio_decoder_config(clear_audio_config); |
82 } | 82 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 static void OnDecoderOutput(const scoped_refptr<AudioBuffer>& output) { | 135 static void OnDecoderOutput(const scoped_refptr<AudioBuffer>& output) { |
136 NOTREACHED(); | 136 NOTREACHED(); |
137 } | 137 } |
138 | 138 |
139 static void OnWaitingForDecryptionKey() { | 139 static void OnWaitingForDecryptionKey() { |
140 NOTREACHED(); | 140 NOTREACHED(); |
141 } | 141 } |
142 | 142 |
143 // Declare |decoder_selector_| after |demuxer_stream_| and |decryptor_| since | 143 // Declare |decoder_selector_| after |demuxer_stream_| and |decryptor_| since |
144 // |demuxer_stream_| and |decryptor_| should outlive |decoder_selector_|. | 144 // |demuxer_stream_| and |decryptor_| should outlive |decoder_selector_|. |
145 scoped_ptr<StrictMock<MockDemuxerStream>> demuxer_stream_; | 145 std::unique_ptr<StrictMock<MockDemuxerStream>> demuxer_stream_; |
146 | 146 |
147 scoped_ptr<StrictMock<MockCdmContext>> cdm_context_; | 147 std::unique_ptr<StrictMock<MockCdmContext>> cdm_context_; |
148 | 148 |
149 // Use NiceMock since we don't care about most of calls on the decryptor, e.g. | 149 // Use NiceMock since we don't care about most of calls on the decryptor, e.g. |
150 // RegisterNewKeyCB(). | 150 // RegisterNewKeyCB(). |
151 scoped_ptr<NiceMock<MockDecryptor>> decryptor_; | 151 std::unique_ptr<NiceMock<MockDecryptor>> decryptor_; |
152 | 152 |
153 scoped_ptr<AudioDecoderSelector> decoder_selector_; | 153 std::unique_ptr<AudioDecoderSelector> decoder_selector_; |
154 | 154 |
155 StrictMock<MockAudioDecoder>* decoder_1_; | 155 StrictMock<MockAudioDecoder>* decoder_1_; |
156 StrictMock<MockAudioDecoder>* decoder_2_; | 156 StrictMock<MockAudioDecoder>* decoder_2_; |
157 ScopedVector<AudioDecoder> all_decoders_; | 157 ScopedVector<AudioDecoder> all_decoders_; |
158 scoped_ptr<AudioDecoder> selected_decoder_; | 158 std::unique_ptr<AudioDecoder> selected_decoder_; |
159 | 159 |
160 base::MessageLoop message_loop_; | 160 base::MessageLoop message_loop_; |
161 | 161 |
162 private: | 162 private: |
163 DISALLOW_COPY_AND_ASSIGN(AudioDecoderSelectorTest); | 163 DISALLOW_COPY_AND_ASSIGN(AudioDecoderSelectorTest); |
164 }; | 164 }; |
165 | 165 |
166 // TODO(xhwang): Add kNoCdm tests for clear stream. | 166 // TODO(xhwang): Add kNoCdm tests for clear stream. |
167 | 167 |
168 // The stream is not encrypted but we have no clear decoder. No decoder can be | 168 // The stream is not encrypted but we have no clear decoder. No decoder can be |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 // initialized and returned. | 376 // initialized and returned. |
377 EXPECT_CALL(*decoder_1_, Initialize(ClearConfig(), _, _, _)) | 377 EXPECT_CALL(*decoder_1_, Initialize(ClearConfig(), _, _, _)) |
378 .WillOnce(RunCallback<2>(true)); | 378 .WillOnce(RunCallback<2>(true)); |
379 EXPECT_CALL(*this, OnDecoderSelected(NotNull(), NotNull())); | 379 EXPECT_CALL(*this, OnDecoderSelected(NotNull(), NotNull())); |
380 #endif | 380 #endif |
381 | 381 |
382 SelectDecoder(); | 382 SelectDecoder(); |
383 } | 383 } |
384 | 384 |
385 } // namespace media | 385 } // namespace media |
OLD | NEW |