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

Side by Side Diff: media/test/pipeline_integration_test_base.cc

Issue 1904793002: Move Pipeline permanent callbacks into Pipeline::Client interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup Created 4 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 "media/test/pipeline_integration_test_base.h" 5 #include "media/test/pipeline_integration_test_base.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 PipelineStatus PipelineIntegrationTestBase::StartInternal( 116 PipelineStatus PipelineIntegrationTestBase::StartInternal(
117 scoped_ptr<DataSource> data_source, 117 scoped_ptr<DataSource> data_source,
118 CdmContext* cdm_context, 118 CdmContext* cdm_context,
119 uint8_t test_type) { 119 uint8_t test_type) {
120 hashing_enabled_ = test_type & kHashed; 120 hashing_enabled_ = test_type & kHashed;
121 clockless_playback_ = test_type & kClockless; 121 clockless_playback_ = test_type & kClockless;
122 122
123 EXPECT_CALL(*this, OnMetadata(_)) 123 EXPECT_CALL(*this, OnMetadata(_))
124 .Times(AtMost(1)) 124 .Times(AtMost(1))
125 .WillRepeatedly(SaveArg<0>(&metadata_)); 125 .WillRepeatedly(SaveArg<0>(&metadata_));
126 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_ENOUGH)) 126 EXPECT_CALL(*this, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH))
127 .Times(AnyNumber()); 127 .Times(AnyNumber());
128 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_NOTHING)) 128 EXPECT_CALL(*this, OnBufferingStateChange(BUFFERING_HAVE_NOTHING))
129 .Times(AnyNumber()); 129 .Times(AnyNumber());
130 CreateDemuxer(std::move(data_source)); 130 CreateDemuxer(std::move(data_source));
131 131
132 if (cdm_context) { 132 if (cdm_context) {
133 EXPECT_CALL(*this, DecryptorAttached(true)); 133 EXPECT_CALL(*this, DecryptorAttached(true));
134 pipeline_->SetCdm( 134 pipeline_->SetCdm(
135 cdm_context, base::Bind(&PipelineIntegrationTestBase::DecryptorAttached, 135 cdm_context, base::Bind(&PipelineIntegrationTestBase::DecryptorAttached,
136 base::Unretained(this))); 136 base::Unretained(this)));
137 } 137 }
138 138
139 // Should never be called as the required decryption keys for the encrypted 139 // Should never be called as the required decryption keys for the encrypted
140 // media files are provided in advance. 140 // media files are provided in advance.
141 EXPECT_CALL(*this, OnWaitingForDecryptionKey()).Times(0); 141 EXPECT_CALL(*this, OnWaitingForDecryptionKey()).Times(0);
142 142
143 pipeline_->Start( 143 pipeline_->Start(demuxer_.get(), CreateRenderer(), this,
144 demuxer_.get(), CreateRenderer(), 144 base::Bind(&PipelineIntegrationTestBase::OnStatusCallback,
145 base::Bind(&PipelineIntegrationTestBase::OnEnded, base::Unretained(this)), 145 base::Unretained(this)));
146 base::Bind(&PipelineIntegrationTestBase::OnError, base::Unretained(this)),
147 base::Bind(&PipelineIntegrationTestBase::OnStatusCallback,
148 base::Unretained(this)),
149 base::Bind(&PipelineIntegrationTestBase::OnMetadata,
150 base::Unretained(this)),
151 base::Bind(&PipelineIntegrationTestBase::OnBufferingStateChanged,
152 base::Unretained(this)),
153 base::Closure(), base::Bind(&PipelineIntegrationTestBase::OnAddTextTrack,
154 base::Unretained(this)),
155 base::Bind(&PipelineIntegrationTestBase::OnWaitingForDecryptionKey,
156 base::Unretained(this)));
157 message_loop_.Run(); 146 message_loop_.Run();
158 return pipeline_status_; 147 return pipeline_status_;
159 } 148 }
160 149
161 PipelineStatus PipelineIntegrationTestBase::StartWithFile( 150 PipelineStatus PipelineIntegrationTestBase::StartWithFile(
162 const std::string& filename, 151 const std::string& filename,
163 CdmContext* cdm_context, 152 CdmContext* cdm_context,
164 uint8_t test_type) { 153 uint8_t test_type) {
165 scoped_ptr<FileDataSource> file_data_source(new FileDataSource()); 154 scoped_ptr<FileDataSource> file_data_source(new FileDataSource());
166 base::FilePath file_path(GetTestDataFilePath(filename)); 155 base::FilePath file_path(GetTestDataFilePath(filename));
(...skipping 27 matching lines...) Expand all
194 pipeline_->SetPlaybackRate(1); 183 pipeline_->SetPlaybackRate(1);
195 } 184 }
196 185
197 void PipelineIntegrationTestBase::Pause() { 186 void PipelineIntegrationTestBase::Pause() {
198 pipeline_->SetPlaybackRate(0); 187 pipeline_->SetPlaybackRate(0);
199 } 188 }
200 189
201 bool PipelineIntegrationTestBase::Seek(base::TimeDelta seek_time) { 190 bool PipelineIntegrationTestBase::Seek(base::TimeDelta seek_time) {
202 ended_ = false; 191 ended_ = false;
203 192
204 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_ENOUGH)) 193 EXPECT_CALL(*this, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH))
205 .WillOnce(InvokeWithoutArgs(&message_loop_, &base::MessageLoop::QuitNow)); 194 .WillOnce(InvokeWithoutArgs(&message_loop_, &base::MessageLoop::QuitNow));
206 pipeline_->Seek(seek_time, base::Bind(&PipelineIntegrationTestBase::OnSeeked, 195 pipeline_->Seek(seek_time, base::Bind(&PipelineIntegrationTestBase::OnSeeked,
207 base::Unretained(this), seek_time)); 196 base::Unretained(this), seek_time));
208 message_loop_.Run(); 197 message_loop_.Run();
209 return (pipeline_status_ == PIPELINE_OK); 198 return (pipeline_status_ == PIPELINE_OK);
210 } 199 }
211 200
212 bool PipelineIntegrationTestBase::Suspend() { 201 bool PipelineIntegrationTestBase::Suspend() {
213 pipeline_->Suspend(base::Bind(&PipelineIntegrationTestBase::OnStatusCallback, 202 pipeline_->Suspend(base::Bind(&PipelineIntegrationTestBase::OnStatusCallback,
214 base::Unretained(this))); 203 base::Unretained(this)));
215 message_loop_.Run(); 204 message_loop_.Run();
216 return (pipeline_status_ == PIPELINE_OK); 205 return (pipeline_status_ == PIPELINE_OK);
217 } 206 }
218 207
219 bool PipelineIntegrationTestBase::Resume(base::TimeDelta seek_time) { 208 bool PipelineIntegrationTestBase::Resume(base::TimeDelta seek_time) {
220 ended_ = false; 209 ended_ = false;
221 210
222 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_ENOUGH)) 211 EXPECT_CALL(*this, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH))
223 .WillOnce(InvokeWithoutArgs(&message_loop_, &base::MessageLoop::QuitNow)); 212 .WillOnce(InvokeWithoutArgs(&message_loop_, &base::MessageLoop::QuitNow));
224 pipeline_->Resume(CreateRenderer(), seek_time, 213 pipeline_->Resume(CreateRenderer(), seek_time,
225 base::Bind(&PipelineIntegrationTestBase::OnSeeked, 214 base::Bind(&PipelineIntegrationTestBase::OnSeeked,
226 base::Unretained(this), seek_time)); 215 base::Unretained(this), seek_time));
227 message_loop_.Run(); 216 message_loop_.Run();
228 return (pipeline_status_ == PIPELINE_OK); 217 return (pipeline_status_ == PIPELINE_OK);
229 } 218 }
230 219
231 void PipelineIntegrationTestBase::Stop() { 220 void PipelineIntegrationTestBase::Stop() {
232 DCHECK(pipeline_->IsRunning()); 221 DCHECK(pipeline_->IsRunning());
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 DCHECK(clockless_playback_); 377 DCHECK(clockless_playback_);
389 return clockless_audio_sink_->render_time(); 378 return clockless_audio_sink_->render_time();
390 } 379 }
391 380
392 base::TimeTicks DummyTickClock::NowTicks() { 381 base::TimeTicks DummyTickClock::NowTicks() {
393 now_ += base::TimeDelta::FromSeconds(60); 382 now_ += base::TimeDelta::FromSeconds(60);
394 return now_; 383 return now_;
395 } 384 }
396 385
397 } // namespace media 386 } // namespace media
OLDNEW
« media/blink/webmediaplayer_impl.cc ('K') | « media/test/pipeline_integration_test_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698