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

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

Issue 11226019: Encrypted Media: Replace DecryptorClient with key event callbacks. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase again Created 7 years, 12 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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 base::Unretained(&statistics_cb_))); 98 base::Unretained(&statistics_cb_)));
99 message_loop_.RunUntilIdle(); 99 message_loop_.RunUntilIdle();
100 } 100 }
101 101
102 void Initialize() { 102 void Initialize() {
103 EXPECT_CALL(*decryptor_, InitializeAudioDecoderMock(_, _)) 103 EXPECT_CALL(*decryptor_, InitializeAudioDecoderMock(_, _))
104 .Times(AtMost(1)) 104 .Times(AtMost(1))
105 .WillOnce(RunCallback<1>(true)); 105 .WillOnce(RunCallback<1>(true));
106 EXPECT_CALL(*this, RequestDecryptorNotification(_)) 106 EXPECT_CALL(*this, RequestDecryptorNotification(_))
107 .WillOnce(RunCallbackIfNotNull(decryptor_.get())); 107 .WillOnce(RunCallbackIfNotNull(decryptor_.get()));
108 EXPECT_CALL(*decryptor_, RegisterKeyAddedCB(Decryptor::kAudio, _)) 108 EXPECT_CALL(*decryptor_, RegisterNewKeyCB(Decryptor::kAudio, _))
109 .WillOnce(SaveArg<1>(&key_added_cb_)); 109 .WillOnce(SaveArg<1>(&key_added_cb_));
110 110
111 AudioDecoderConfig config(kCodecVorbis, 16, CHANNEL_LAYOUT_STEREO, 44100, 111 AudioDecoderConfig config(kCodecVorbis, 16, CHANNEL_LAYOUT_STEREO, 44100,
112 NULL, 0, true); 112 NULL, 0, true);
113 InitializeAndExpectStatus(config, PIPELINE_OK); 113 InitializeAndExpectStatus(config, PIPELINE_OK);
114 114
115 EXPECT_EQ(16, decoder_->bits_per_channel()); 115 EXPECT_EQ(16, decoder_->bits_per_channel());
116 EXPECT_EQ(CHANNEL_LAYOUT_STEREO, decoder_->channel_layout()); 116 EXPECT_EQ(CHANNEL_LAYOUT_STEREO, decoder_->channel_layout());
117 EXPECT_EQ(44100, decoder_->samples_per_second()); 117 EXPECT_EQ(44100, decoder_->samples_per_second());
118 } 118 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 const scoped_refptr<Buffer>&)); 217 const scoped_refptr<Buffer>&));
218 218
219 MessageLoop message_loop_; 219 MessageLoop message_loop_;
220 scoped_refptr<DecryptingAudioDecoder> decoder_; 220 scoped_refptr<DecryptingAudioDecoder> decoder_;
221 scoped_ptr<StrictMock<MockDecryptor> > decryptor_; 221 scoped_ptr<StrictMock<MockDecryptor> > decryptor_;
222 scoped_refptr<StrictMock<MockDemuxerStream> > demuxer_; 222 scoped_refptr<StrictMock<MockDemuxerStream> > demuxer_;
223 MockStatisticsCB statistics_cb_; 223 MockStatisticsCB statistics_cb_;
224 224
225 DemuxerStream::ReadCB pending_demuxer_read_cb_; 225 DemuxerStream::ReadCB pending_demuxer_read_cb_;
226 Decryptor::DecoderInitCB pending_init_cb_; 226 Decryptor::DecoderInitCB pending_init_cb_;
227 Decryptor::KeyAddedCB key_added_cb_; 227 Decryptor::NewKeyCB key_added_cb_;
228 Decryptor::AudioDecodeCB pending_audio_decode_cb_; 228 Decryptor::AudioDecodeCB pending_audio_decode_cb_;
229 229
230 // Constant buffer/frames to be returned by the |demuxer_| and |decryptor_|. 230 // Constant buffer/frames to be returned by the |demuxer_| and |decryptor_|.
231 scoped_refptr<DecoderBuffer> encrypted_buffer_; 231 scoped_refptr<DecoderBuffer> encrypted_buffer_;
232 scoped_refptr<Buffer> decoded_frame_; 232 scoped_refptr<Buffer> decoded_frame_;
233 scoped_refptr<Buffer> end_of_stream_frame_; 233 scoped_refptr<Buffer> end_of_stream_frame_;
234 Decryptor::AudioBuffers decoded_frame_list_; 234 Decryptor::AudioBuffers decoded_frame_list_;
235 235
236 private: 236 private:
237 DISALLOW_COPY_AND_ASSIGN(DecryptingAudioDecoderTest); 237 DISALLOW_COPY_AND_ASSIGN(DecryptingAudioDecoderTest);
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 EXPECT_CALL(*demuxer_, Read(_)) 465 EXPECT_CALL(*demuxer_, Read(_))
466 .WillOnce(RunCallback<0>(DemuxerStream::kConfigChanged, 466 .WillOnce(RunCallback<0>(DemuxerStream::kConfigChanged,
467 scoped_refptr<DecoderBuffer>())); 467 scoped_refptr<DecoderBuffer>()));
468 468
469 // TODO(xhwang): Update this test when kConfigChanged is supported in 469 // TODO(xhwang): Update this test when kConfigChanged is supported in
470 // DecryptingAudioDecoder. 470 // DecryptingAudioDecoder.
471 ReadAndExpectFrameReadyWith(AudioDecoder::kDecodeError, NULL); 471 ReadAndExpectFrameReadyWith(AudioDecoder::kDecodeError, NULL);
472 } 472 }
473 473
474 } // namespace media 474 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698