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

Side by Side Diff: media/filters/decrypting_video_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_video_decoder.cc ('k') | media/filters/ffmpeg_audio_decoder.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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 std::string(reinterpret_cast<const char*>(kFakeIv), arraysize(kFakeIv)), 43 std::string(reinterpret_cast<const char*>(kFakeIv), arraysize(kFakeIv)),
44 std::vector<SubsampleEntry>()))); 44 std::vector<SubsampleEntry>())));
45 return buffer; 45 return buffer;
46 } 46 }
47 47
48 class DecryptingVideoDecoderTest : public testing::Test { 48 class DecryptingVideoDecoderTest : public testing::Test {
49 public: 49 public:
50 DecryptingVideoDecoderTest() 50 DecryptingVideoDecoderTest()
51 : decoder_(new DecryptingVideoDecoder( 51 : decoder_(new DecryptingVideoDecoder(
52 message_loop_.task_runner(), 52 message_loop_.task_runner(),
53 new MediaLog(), 53 &media_log_,
54 base::Bind(&DecryptingVideoDecoderTest::OnWaitingForDecryptionKey, 54 base::Bind(&DecryptingVideoDecoderTest::OnWaitingForDecryptionKey,
55 base::Unretained(this)))), 55 base::Unretained(this)))),
56 cdm_context_(new StrictMock<MockCdmContext>()), 56 cdm_context_(new StrictMock<MockCdmContext>()),
57 decryptor_(new StrictMock<MockDecryptor>()), 57 decryptor_(new StrictMock<MockDecryptor>()),
58 num_decrypt_and_decode_calls_(0), 58 num_decrypt_and_decode_calls_(0),
59 num_frames_in_decryptor_(0), 59 num_frames_in_decryptor_(0),
60 encrypted_buffer_(CreateFakeEncryptedBuffer()), 60 encrypted_buffer_(CreateFakeEncryptedBuffer()),
61 decoded_video_frame_( 61 decoded_video_frame_(
62 VideoFrame::CreateBlackFrame(TestVideoConfig::NormalCodedSize())), 62 VideoFrame::CreateBlackFrame(TestVideoConfig::NormalCodedSize())),
63 null_video_frame_(scoped_refptr<VideoFrame>()) {} 63 null_video_frame_(scoped_refptr<VideoFrame>()) {}
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 decoder_.reset(); 216 decoder_.reset();
217 base::RunLoop().RunUntilIdle(); 217 base::RunLoop().RunUntilIdle();
218 } 218 }
219 219
220 MOCK_METHOD1(FrameReady, void(const scoped_refptr<VideoFrame>&)); 220 MOCK_METHOD1(FrameReady, void(const scoped_refptr<VideoFrame>&));
221 MOCK_METHOD1(DecodeDone, void(DecodeStatus)); 221 MOCK_METHOD1(DecodeDone, void(DecodeStatus));
222 222
223 MOCK_METHOD0(OnWaitingForDecryptionKey, void(void)); 223 MOCK_METHOD0(OnWaitingForDecryptionKey, void(void));
224 224
225 base::MessageLoop message_loop_; 225 base::MessageLoop message_loop_;
226 MediaLog media_log_;
226 std::unique_ptr<DecryptingVideoDecoder> decoder_; 227 std::unique_ptr<DecryptingVideoDecoder> decoder_;
227 std::unique_ptr<StrictMock<MockCdmContext>> cdm_context_; 228 std::unique_ptr<StrictMock<MockCdmContext>> cdm_context_;
228 std::unique_ptr<StrictMock<MockDecryptor>> decryptor_; 229 std::unique_ptr<StrictMock<MockDecryptor>> decryptor_;
229 230
230 // Variables to help the |decryptor_| to simulate decoding delay and flushing. 231 // Variables to help the |decryptor_| to simulate decoding delay and flushing.
231 int num_decrypt_and_decode_calls_; 232 int num_decrypt_and_decode_calls_;
232 int num_frames_in_decryptor_; 233 int num_frames_in_decryptor_;
233 234
234 Decryptor::DecoderInitCB pending_init_cb_; 235 Decryptor::DecoderInitCB pending_init_cb_;
235 Decryptor::NewKeyCB key_added_cb_; 236 Decryptor::NewKeyCB key_added_cb_;
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 476
476 // Test destruction after the decoder has been reset. 477 // Test destruction after the decoder has been reset.
477 TEST_F(DecryptingVideoDecoderTest, Destroy_AfterReset) { 478 TEST_F(DecryptingVideoDecoderTest, Destroy_AfterReset) {
478 Initialize(); 479 Initialize();
479 EnterNormalDecodingState(); 480 EnterNormalDecodingState();
480 Reset(); 481 Reset();
481 Destroy(); 482 Destroy();
482 } 483 }
483 484
484 } // namespace media 485 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/decrypting_video_decoder.cc ('k') | media/filters/ffmpeg_audio_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698