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

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

Issue 2815303006: Convert MediaLog from being ref counted to owned by WebMediaPlayer. (Closed)
Patch Set: Rebase. Created 3 years, 8 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
« no previous file with comments | « media/filters/decrypting_audio_decoder.cc ('k') | media/filters/decrypting_demuxer_stream.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 std::string(reinterpret_cast<const char*>(kFakeIv), arraysize(kFakeIv)), 50 std::string(reinterpret_cast<const char*>(kFakeIv), arraysize(kFakeIv)),
51 std::vector<SubsampleEntry>()))); 51 std::vector<SubsampleEntry>())));
52 return buffer; 52 return buffer;
53 } 53 }
54 54
55 class DecryptingAudioDecoderTest : public testing::Test { 55 class DecryptingAudioDecoderTest : public testing::Test {
56 public: 56 public:
57 DecryptingAudioDecoderTest() 57 DecryptingAudioDecoderTest()
58 : decoder_(new DecryptingAudioDecoder( 58 : decoder_(new DecryptingAudioDecoder(
59 message_loop_.task_runner(), 59 message_loop_.task_runner(),
60 new MediaLog(), 60 &media_log_,
61 base::Bind(&DecryptingAudioDecoderTest::OnWaitingForDecryptionKey, 61 base::Bind(&DecryptingAudioDecoderTest::OnWaitingForDecryptionKey,
62 base::Unretained(this)))), 62 base::Unretained(this)))),
63 cdm_context_(new StrictMock<MockCdmContext>()), 63 cdm_context_(new StrictMock<MockCdmContext>()),
64 decryptor_(new StrictMock<MockDecryptor>()), 64 decryptor_(new StrictMock<MockDecryptor>()),
65 num_decrypt_and_decode_calls_(0), 65 num_decrypt_and_decode_calls_(0),
66 num_frames_in_decryptor_(0), 66 num_frames_in_decryptor_(0),
67 encrypted_buffer_(CreateFakeEncryptedBuffer()), 67 encrypted_buffer_(CreateFakeEncryptedBuffer()),
68 decoded_frame_(NULL), 68 decoded_frame_(NULL),
69 decoded_frame_list_() {} 69 decoded_frame_list_() {}
70 70
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 decoder_.reset(); 239 decoder_.reset();
240 base::RunLoop().RunUntilIdle(); 240 base::RunLoop().RunUntilIdle();
241 } 241 }
242 242
243 MOCK_METHOD1(FrameReady, void(const scoped_refptr<AudioBuffer>&)); 243 MOCK_METHOD1(FrameReady, void(const scoped_refptr<AudioBuffer>&));
244 MOCK_METHOD1(DecodeDone, void(DecodeStatus)); 244 MOCK_METHOD1(DecodeDone, void(DecodeStatus));
245 245
246 MOCK_METHOD0(OnWaitingForDecryptionKey, void(void)); 246 MOCK_METHOD0(OnWaitingForDecryptionKey, void(void));
247 247
248 base::MessageLoop message_loop_; 248 base::MessageLoop message_loop_;
249 MediaLog media_log_;
249 std::unique_ptr<DecryptingAudioDecoder> decoder_; 250 std::unique_ptr<DecryptingAudioDecoder> decoder_;
250 std::unique_ptr<StrictMock<MockCdmContext>> cdm_context_; 251 std::unique_ptr<StrictMock<MockCdmContext>> cdm_context_;
251 std::unique_ptr<StrictMock<MockDecryptor>> decryptor_; 252 std::unique_ptr<StrictMock<MockDecryptor>> decryptor_;
252 AudioDecoderConfig config_; 253 AudioDecoderConfig config_;
253 254
254 // Variables to help the |decryptor_| to simulate decoding delay and flushing. 255 // Variables to help the |decryptor_| to simulate decoding delay and flushing.
255 int num_decrypt_and_decode_calls_; 256 int num_decrypt_and_decode_calls_;
256 int num_frames_in_decryptor_; 257 int num_frames_in_decryptor_;
257 258
258 Decryptor::DecoderInitCB pending_init_cb_; 259 Decryptor::DecoderInitCB pending_init_cb_;
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 473
473 // Test resetting after the decoder has been reset. 474 // Test resetting after the decoder has been reset.
474 TEST_F(DecryptingAudioDecoderTest, Reset_AfterReset) { 475 TEST_F(DecryptingAudioDecoderTest, Reset_AfterReset) {
475 Initialize(); 476 Initialize();
476 EnterNormalDecodingState(); 477 EnterNormalDecodingState();
477 Reset(); 478 Reset();
478 Reset(); 479 Reset();
479 } 480 }
480 481
481 } // namespace media 482 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/decrypting_audio_decoder.cc ('k') | media/filters/decrypting_demuxer_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698