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

Side by Side Diff: media/filters/audio_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, 6 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/cdm/cdm_adapter_unittest.cc ('k') | media/filters/chunk_demuxer_unittest.cc » ('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 <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/media_util.h" 15 #include "media/base/media_util.h"
15 #include "media/base/mock_filters.h" 16 #include "media/base/mock_filters.h"
16 #include "media/base/test_helpers.h" 17 #include "media/base/test_helpers.h"
17 #include "media/filters/decoder_selector.h" 18 #include "media/filters/decoder_selector.h"
18 #include "media/filters/decrypting_demuxer_stream.h" 19 #include "media/filters/decrypting_demuxer_stream.h"
19 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
20 21
21 using ::testing::_; 22 using ::testing::_;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 : demuxer_stream_( 55 : demuxer_stream_(
55 new StrictMock<MockDemuxerStream>(DemuxerStream::AUDIO)), 56 new StrictMock<MockDemuxerStream>(DemuxerStream::AUDIO)),
56 decoder_1_(new StrictMock<MockAudioDecoder>()), 57 decoder_1_(new StrictMock<MockAudioDecoder>()),
57 decoder_2_(new StrictMock<MockAudioDecoder>()) { 58 decoder_2_(new StrictMock<MockAudioDecoder>()) {
58 all_decoders_.push_back(decoder_1_); 59 all_decoders_.push_back(decoder_1_);
59 all_decoders_.push_back(decoder_2_); 60 all_decoders_.push_back(decoder_2_);
60 // |cdm_context_| and |decryptor_| are conditionally created in 61 // |cdm_context_| and |decryptor_| are conditionally created in
61 // InitializeDecoderSelector(). 62 // InitializeDecoderSelector().
62 } 63 }
63 64
64 ~AudioDecoderSelectorTest() { 65 ~AudioDecoderSelectorTest() { base::RunLoop().RunUntilIdle(); }
65 message_loop_.RunUntilIdle();
66 }
67 66
68 MOCK_METHOD2(OnDecoderSelected, 67 MOCK_METHOD2(OnDecoderSelected,
69 void(AudioDecoder*, DecryptingDemuxerStream*)); 68 void(AudioDecoder*, DecryptingDemuxerStream*));
70 69
71 void MockOnDecoderSelected(std::unique_ptr<AudioDecoder> decoder, 70 void MockOnDecoderSelected(std::unique_ptr<AudioDecoder> decoder,
72 std::unique_ptr<DecryptingDemuxerStream> stream) { 71 std::unique_ptr<DecryptingDemuxerStream> stream) {
73 OnDecoderSelected(decoder.get(), stream.get()); 72 OnDecoderSelected(decoder.get(), stream.get());
74 selected_decoder_ = std::move(decoder); 73 selected_decoder_ = std::move(decoder);
75 } 74 }
76 75
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 message_loop_.task_runner(), std::move(all_decoders_), new MediaLog())); 113 message_loop_.task_runner(), std::move(all_decoders_), new MediaLog()));
115 } 114 }
116 115
117 void SelectDecoder() { 116 void SelectDecoder() {
118 decoder_selector_->SelectDecoder( 117 decoder_selector_->SelectDecoder(
119 demuxer_stream_.get(), cdm_context_.get(), 118 demuxer_stream_.get(), cdm_context_.get(),
120 base::Bind(&AudioDecoderSelectorTest::MockOnDecoderSelected, 119 base::Bind(&AudioDecoderSelectorTest::MockOnDecoderSelected,
121 base::Unretained(this)), 120 base::Unretained(this)),
122 base::Bind(&AudioDecoderSelectorTest::OnDecoderOutput), 121 base::Bind(&AudioDecoderSelectorTest::OnDecoderOutput),
123 base::Bind(&AudioDecoderSelectorTest::OnWaitingForDecryptionKey)); 122 base::Bind(&AudioDecoderSelectorTest::OnWaitingForDecryptionKey));
124 message_loop_.RunUntilIdle(); 123 base::RunLoop().RunUntilIdle();
125 } 124 }
126 125
127 void SelectDecoderAndDestroy() { 126 void SelectDecoderAndDestroy() {
128 SelectDecoder(); 127 SelectDecoder();
129 128
130 EXPECT_CALL(*this, OnDecoderSelected(IsNull(), IsNull())); 129 EXPECT_CALL(*this, OnDecoderSelected(IsNull(), IsNull()));
131 decoder_selector_.reset(); 130 decoder_selector_.reset();
132 message_loop_.RunUntilIdle(); 131 base::RunLoop().RunUntilIdle();
133 } 132 }
134 133
135 static void OnDecoderOutput(const scoped_refptr<AudioBuffer>& output) { 134 static void OnDecoderOutput(const scoped_refptr<AudioBuffer>& output) {
136 NOTREACHED(); 135 NOTREACHED();
137 } 136 }
138 137
139 static void OnWaitingForDecryptionKey() { 138 static void OnWaitingForDecryptionKey() {
140 NOTREACHED(); 139 NOTREACHED();
141 } 140 }
142 141
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 // initialized and returned. 375 // initialized and returned.
377 EXPECT_CALL(*decoder_1_, Initialize(ClearConfig(), _, _, _)) 376 EXPECT_CALL(*decoder_1_, Initialize(ClearConfig(), _, _, _))
378 .WillOnce(RunCallback<2>(true)); 377 .WillOnce(RunCallback<2>(true));
379 EXPECT_CALL(*this, OnDecoderSelected(NotNull(), NotNull())); 378 EXPECT_CALL(*this, OnDecoderSelected(NotNull(), NotNull()));
380 #endif 379 #endif
381 380
382 SelectDecoder(); 381 SelectDecoder();
383 } 382 }
384 383
385 } // namespace media 384 } // namespace media
OLDNEW
« no previous file with comments | « media/cdm/cdm_adapter_unittest.cc ('k') | media/filters/chunk_demuxer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698