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

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

Issue 2086353002: Remove calls to deprecated MessageLoop methods in media. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 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 <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"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/run_loop.h"
12 #include "build/build_config.h" 13 #include "build/build_config.h"
13 #include "media/base/gmock_callback_support.h" 14 #include "media/base/gmock_callback_support.h"
14 #include "media/base/mock_filters.h" 15 #include "media/base/mock_filters.h"
15 #include "media/base/test_helpers.h" 16 #include "media/base/test_helpers.h"
16 #include "media/filters/decoder_selector.h" 17 #include "media/filters/decoder_selector.h"
17 #include "media/filters/decrypting_demuxer_stream.h" 18 #include "media/filters/decrypting_demuxer_stream.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 20
20 using ::testing::_; 21 using ::testing::_;
21 using ::testing::IsNull; 22 using ::testing::IsNull;
(...skipping 30 matching lines...) Expand all
52 : demuxer_stream_( 53 : demuxer_stream_(
53 new StrictMock<MockDemuxerStream>(DemuxerStream::VIDEO)), 54 new StrictMock<MockDemuxerStream>(DemuxerStream::VIDEO)),
54 decoder_1_(new StrictMock<MockVideoDecoder>()), 55 decoder_1_(new StrictMock<MockVideoDecoder>()),
55 decoder_2_(new StrictMock<MockVideoDecoder>()) { 56 decoder_2_(new StrictMock<MockVideoDecoder>()) {
56 all_decoders_.push_back(decoder_1_); 57 all_decoders_.push_back(decoder_1_);
57 all_decoders_.push_back(decoder_2_); 58 all_decoders_.push_back(decoder_2_);
58 // |cdm_context_| and |decryptor_| are conditionally created in 59 // |cdm_context_| and |decryptor_| are conditionally created in
59 // InitializeDecoderSelector(). 60 // InitializeDecoderSelector().
60 } 61 }
61 62
62 ~VideoDecoderSelectorTest() { 63 ~VideoDecoderSelectorTest() { base::RunLoop().RunUntilIdle(); }
63 message_loop_.RunUntilIdle();
64 }
65 64
66 MOCK_METHOD2(OnDecoderSelected, 65 MOCK_METHOD2(OnDecoderSelected,
67 void(VideoDecoder*, DecryptingDemuxerStream*)); 66 void(VideoDecoder*, DecryptingDemuxerStream*));
68 67
69 void MockOnDecoderSelected(std::unique_ptr<VideoDecoder> decoder, 68 void MockOnDecoderSelected(std::unique_ptr<VideoDecoder> decoder,
70 std::unique_ptr<DecryptingDemuxerStream> stream) { 69 std::unique_ptr<DecryptingDemuxerStream> stream) {
71 OnDecoderSelected(decoder.get(), stream.get()); 70 OnDecoderSelected(decoder.get(), stream.get());
72 selected_decoder_ = std::move(decoder); 71 selected_decoder_ = std::move(decoder);
73 } 72 }
74 73
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 108
110 void SelectDecoder() { 109 void SelectDecoder() {
111 decoder_selector_->SelectDecoder( 110 decoder_selector_->SelectDecoder(
112 demuxer_stream_.get(), cdm_context_.get(), 111 demuxer_stream_.get(), cdm_context_.get(),
113 base::Bind(&VideoDecoderSelectorTest::MockOnDecoderSelected, 112 base::Bind(&VideoDecoderSelectorTest::MockOnDecoderSelected,
114 base::Unretained(this)), 113 base::Unretained(this)),
115 base::Bind(&VideoDecoderSelectorTest::FrameReady, 114 base::Bind(&VideoDecoderSelectorTest::FrameReady,
116 base::Unretained(this)), 115 base::Unretained(this)),
117 base::Bind(&VideoDecoderSelectorTest::OnWaitingForDecryptionKey, 116 base::Bind(&VideoDecoderSelectorTest::OnWaitingForDecryptionKey,
118 base::Unretained(this))); 117 base::Unretained(this)));
119 message_loop_.RunUntilIdle(); 118 base::RunLoop().RunUntilIdle();
120 } 119 }
121 120
122 void SelectDecoderAndDestroy() { 121 void SelectDecoderAndDestroy() {
123 SelectDecoder(); 122 SelectDecoder();
124 123
125 EXPECT_CALL(*this, OnDecoderSelected(IsNull(), IsNull())); 124 EXPECT_CALL(*this, OnDecoderSelected(IsNull(), IsNull()));
126 decoder_selector_.reset(); 125 decoder_selector_.reset();
127 message_loop_.RunUntilIdle(); 126 base::RunLoop().RunUntilIdle();
128 } 127 }
129 128
130 void FrameReady(const scoped_refptr<VideoFrame>& frame) { 129 void FrameReady(const scoped_refptr<VideoFrame>& frame) {
131 NOTREACHED(); 130 NOTREACHED();
132 } 131 }
133 132
134 void OnWaitingForDecryptionKey() { 133 void OnWaitingForDecryptionKey() {
135 NOTREACHED(); 134 NOTREACHED();
136 } 135 }
137 136
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 // initialized and returned. 372 // initialized and returned.
374 EXPECT_CALL(*decoder_1_, Initialize(ClearConfig(), _, _, _, _)) 373 EXPECT_CALL(*decoder_1_, Initialize(ClearConfig(), _, _, _, _))
375 .WillOnce(RunCallback<3>(true)); 374 .WillOnce(RunCallback<3>(true));
376 EXPECT_CALL(*this, OnDecoderSelected(NotNull(), NotNull())); 375 EXPECT_CALL(*this, OnDecoderSelected(NotNull(), NotNull()));
377 #endif 376 #endif
378 377
379 SelectDecoder(); 378 SelectDecoder();
380 } 379 }
381 380
382 } // namespace media 381 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/pipeline_controller_unittest.cc ('k') | media/filters/video_frame_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698