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

Side by Side Diff: media/filters/video_frame_stream_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
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 <utility> 5 #include <utility>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 decoder2_->EnableEncryptedConfigSupport(); 85 decoder2_->EnableEncryptedConfigSupport();
86 decoder3_->EnableEncryptedConfigSupport(); 86 decoder3_->EnableEncryptedConfigSupport();
87 } 87 }
88 88
89 ScopedVector<VideoDecoder> decoders; 89 ScopedVector<VideoDecoder> decoders;
90 decoders.push_back(decoder1_); 90 decoders.push_back(decoder1_);
91 decoders.push_back(decoder2_); 91 decoders.push_back(decoder2_);
92 decoders.push_back(decoder3_); 92 decoders.push_back(decoder3_);
93 93
94 video_frame_stream_.reset(new VideoFrameStream( 94 video_frame_stream_.reset(new VideoFrameStream(
95 message_loop_.task_runner(), std::move(decoders), new MediaLog())); 95 message_loop_.task_runner(), std::move(decoders), &media_log_));
96 96
97 if (GetParam().is_encrypted && GetParam().has_decryptor) { 97 if (GetParam().is_encrypted && GetParam().has_decryptor) {
98 decryptor_.reset(new NiceMock<MockDecryptor>()); 98 decryptor_.reset(new NiceMock<MockDecryptor>());
99 99
100 // Decryptor can only decrypt (not decrypt-and-decode) so that 100 // Decryptor can only decrypt (not decrypt-and-decode) so that
101 // DecryptingDemuxerStream will be used. 101 // DecryptingDemuxerStream will be used.
102 EXPECT_CALL(*decryptor_, InitializeVideoDecoder(_, _)) 102 EXPECT_CALL(*decryptor_, InitializeVideoDecoder(_, _))
103 .WillRepeatedly(RunCallback<1>(false)); 103 .WillRepeatedly(RunCallback<1>(false));
104 EXPECT_CALL(*decryptor_, Decrypt(_, _, _)) 104 EXPECT_CALL(*decryptor_, Decrypt(_, _, _))
105 .WillRepeatedly(Invoke(this, &VideoFrameStreamTest::Decrypt)); 105 .WillRepeatedly(Invoke(this, &VideoFrameStreamTest::Decrypt));
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 SatisfyPendingCallback(DECODER_RESET); 357 SatisfyPendingCallback(DECODER_RESET);
358 } 358 }
359 359
360 void ReadUntilDecoderReinitialized(FakeVideoDecoder* decoder) { 360 void ReadUntilDecoderReinitialized(FakeVideoDecoder* decoder) {
361 EnterPendingState(DECODER_REINIT, decoder); 361 EnterPendingState(DECODER_REINIT, decoder);
362 SatisfyPendingCallback(DECODER_REINIT, decoder); 362 SatisfyPendingCallback(DECODER_REINIT, decoder);
363 } 363 }
364 364
365 base::MessageLoop message_loop_; 365 base::MessageLoop message_loop_;
366 366
367 MediaLog media_log_;
367 std::unique_ptr<VideoFrameStream> video_frame_stream_; 368 std::unique_ptr<VideoFrameStream> video_frame_stream_;
368 std::unique_ptr<FakeDemuxerStream> demuxer_stream_; 369 std::unique_ptr<FakeDemuxerStream> demuxer_stream_;
369 std::unique_ptr<StrictMock<MockCdmContext>> cdm_context_; 370 std::unique_ptr<StrictMock<MockCdmContext>> cdm_context_;
370 371
371 // Use NiceMock since we don't care about most of calls on the decryptor, 372 // Use NiceMock since we don't care about most of calls on the decryptor,
372 // e.g. RegisterNewKeyCB(). 373 // e.g. RegisterNewKeyCB().
373 std::unique_ptr<NiceMock<MockDecryptor>> decryptor_; 374 std::unique_ptr<NiceMock<MockDecryptor>> decryptor_;
374 375
375 // Three decoders are needed to test that decoder fallback can occur more than 376 // Three decoders are needed to test that decoder fallback can occur more than
376 // once on a config change. They are owned by |video_frame_stream_|. 377 // once on a config change. They are owned by |video_frame_stream_|.
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 1122
1122 TEST_P(VideoFrameStreamTest, Destroy_DuringFallbackDecoderSelection) { 1123 TEST_P(VideoFrameStreamTest, Destroy_DuringFallbackDecoderSelection) {
1123 Initialize(); 1124 Initialize();
1124 decoder1_->SimulateFailureToInit(); 1125 decoder1_->SimulateFailureToInit();
1125 EnterPendingState(DECODER_REINIT); 1126 EnterPendingState(DECODER_REINIT);
1126 decoder2_->HoldNextInit(); 1127 decoder2_->HoldNextInit();
1127 SatisfyPendingCallback(DECODER_REINIT); 1128 SatisfyPendingCallback(DECODER_REINIT);
1128 } 1129 }
1129 1130
1130 } // namespace media 1131 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/video_decoder_selector_unittest.cc ('k') | media/filters/video_renderer_algorithm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698