| OLD | NEW |
| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/threading/simple_thread.h" | 10 #include "base/threading/simple_thread.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 class CallbackHelper { | 71 class CallbackHelper { |
| 72 public: | 72 public: |
| 73 CallbackHelper() {} | 73 CallbackHelper() {} |
| 74 virtual ~CallbackHelper() {} | 74 virtual ~CallbackHelper() {} |
| 75 | 75 |
| 76 MOCK_METHOD1(OnStart, void(PipelineStatus)); | 76 MOCK_METHOD1(OnStart, void(PipelineStatus)); |
| 77 MOCK_METHOD1(OnSeek, void(PipelineStatus)); | 77 MOCK_METHOD1(OnSeek, void(PipelineStatus)); |
| 78 MOCK_METHOD0(OnStop, void()); | 78 MOCK_METHOD0(OnStop, void()); |
| 79 MOCK_METHOD1(OnEnded, void(PipelineStatus)); | 79 MOCK_METHOD1(OnEnded, void(PipelineStatus)); |
| 80 MOCK_METHOD1(OnError, void(PipelineStatus)); | 80 MOCK_METHOD1(OnError, void(PipelineStatus)); |
| 81 MOCK_METHOD1(OnReadyState, void(Pipeline::ReadyState)); |
| 81 | 82 |
| 82 private: | 83 private: |
| 83 DISALLOW_COPY_AND_ASSIGN(CallbackHelper); | 84 DISALLOW_COPY_AND_ASSIGN(CallbackHelper); |
| 84 }; | 85 }; |
| 85 | 86 |
| 86 // TODO(scherkus): even though some filters are initialized on separate | 87 // TODO(scherkus): even though some filters are initialized on separate |
| 87 // threads these test aren't flaky... why? It's because filters' Initialize() | 88 // threads these test aren't flaky... why? It's because filters' Initialize() |
| 88 // is executed on |message_loop_| and the mock filters instantly call | 89 // is executed on |message_loop_| and the mock filters instantly call |
| 89 // InitializationComplete(), which keeps the pipeline humming along. If | 90 // InitializationComplete(), which keeps the pipeline humming along. If |
| 90 // either filters don't call InitializationComplete() immediately or filter | 91 // either filters don't call InitializationComplete() immediately or filter |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 RunPipelineStatusCB())); | 211 RunPipelineStatusCB())); |
| 211 } | 212 } |
| 212 } | 213 } |
| 213 | 214 |
| 214 // Sets up expectations on the callback and initializes the pipeline. Called | 215 // Sets up expectations on the callback and initializes the pipeline. Called |
| 215 // after tests have set expectations any filters they wish to use. | 216 // after tests have set expectations any filters they wish to use. |
| 216 void InitializePipeline(PipelineStatus start_status) { | 217 void InitializePipeline(PipelineStatus start_status) { |
| 217 EXPECT_CALL(callbacks_, OnStart(start_status)); | 218 EXPECT_CALL(callbacks_, OnStart(start_status)); |
| 218 | 219 |
| 219 if (start_status == PIPELINE_OK) { | 220 if (start_status == PIPELINE_OK) { |
| 221 EXPECT_CALL(callbacks_, OnReadyState(Pipeline::kHaveMetadata)); |
| 220 EXPECT_CALL(*mocks_->demuxer(), SetPlaybackRate(0.0f)); | 222 EXPECT_CALL(*mocks_->demuxer(), SetPlaybackRate(0.0f)); |
| 221 | 223 |
| 222 if (audio_stream_) { | 224 if (audio_stream_) { |
| 223 EXPECT_CALL(*mocks_->audio_renderer(), SetPlaybackRate(0.0f)); | 225 EXPECT_CALL(*mocks_->audio_renderer(), SetPlaybackRate(0.0f)); |
| 224 EXPECT_CALL(*mocks_->audio_renderer(), SetVolume(1.0f)); | 226 EXPECT_CALL(*mocks_->audio_renderer(), SetVolume(1.0f)); |
| 225 | 227 |
| 226 // Startup sequence. | 228 // Startup sequence. |
| 227 EXPECT_CALL(*mocks_->audio_renderer(), Preroll(base::TimeDelta(), _)) | 229 EXPECT_CALL(*mocks_->audio_renderer(), Preroll(base::TimeDelta(), _)) |
| 228 .WillOnce(RunPipelineStatusCB()); | 230 .WillOnce(RunPipelineStatusCB()); |
| 229 EXPECT_CALL(*mocks_->audio_renderer(), Play(_)) | 231 EXPECT_CALL(*mocks_->audio_renderer(), Play(_)) |
| 230 .WillOnce(RunClosure()); | 232 .WillOnce(RunClosure()); |
| 231 } | 233 } |
| 234 EXPECT_CALL(callbacks_, OnReadyState(Pipeline::kHaveEnoughData)); |
| 232 } | 235 } |
| 233 | 236 |
| 234 pipeline_->Start( | 237 pipeline_->Start( |
| 235 mocks_->Create().Pass(), | 238 mocks_->Create().Pass(), |
| 236 base::Bind(&CallbackHelper::OnEnded, base::Unretained(&callbacks_)), | 239 base::Bind(&CallbackHelper::OnEnded, base::Unretained(&callbacks_)), |
| 237 base::Bind(&CallbackHelper::OnError, base::Unretained(&callbacks_)), | 240 base::Bind(&CallbackHelper::OnError, base::Unretained(&callbacks_)), |
| 238 base::Bind(&CallbackHelper::OnStart, base::Unretained(&callbacks_))); | 241 base::Bind(&CallbackHelper::OnStart, base::Unretained(&callbacks_)), |
| 242 base::Bind(&CallbackHelper::OnReadyState, |
| 243 base::Unretained(&callbacks_))); |
| 239 message_loop_.RunAllPending(); | 244 message_loop_.RunAllPending(); |
| 240 } | 245 } |
| 241 | 246 |
| 242 void CreateAudioStream() { | 247 void CreateAudioStream() { |
| 243 audio_stream_ = CreateStream(DemuxerStream::AUDIO); | 248 audio_stream_ = CreateStream(DemuxerStream::AUDIO); |
| 244 } | 249 } |
| 245 | 250 |
| 246 void CreateVideoStream() { | 251 void CreateVideoStream() { |
| 247 video_stream_ = CreateStream(DemuxerStream::VIDEO); | 252 video_stream_ = CreateStream(DemuxerStream::VIDEO); |
| 253 EXPECT_CALL(*video_stream_, video_decoder_config()) |
| 254 .WillRepeatedly(ReturnRef(video_decoder_config_)); |
| 248 } | 255 } |
| 249 | 256 |
| 250 MockDemuxerStream* audio_stream() { | 257 MockDemuxerStream* audio_stream() { |
| 251 return audio_stream_; | 258 return audio_stream_; |
| 252 } | 259 } |
| 253 | 260 |
| 254 MockDemuxerStream* video_stream() { | 261 MockDemuxerStream* video_stream() { |
| 255 return video_stream_; | 262 return video_stream_; |
| 256 } | 263 } |
| 257 | 264 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 275 EXPECT_CALL(*mocks_->video_renderer(), Pause(_)) | 282 EXPECT_CALL(*mocks_->video_renderer(), Pause(_)) |
| 276 .WillOnce(RunClosure()); | 283 .WillOnce(RunClosure()); |
| 277 EXPECT_CALL(*mocks_->video_renderer(), Flush(_)) | 284 EXPECT_CALL(*mocks_->video_renderer(), Flush(_)) |
| 278 .WillOnce(RunClosure()); | 285 .WillOnce(RunClosure()); |
| 279 EXPECT_CALL(*mocks_->video_renderer(), Preroll(seek_time, _)) | 286 EXPECT_CALL(*mocks_->video_renderer(), Preroll(seek_time, _)) |
| 280 .WillOnce(RunPipelineStatusCB()); | 287 .WillOnce(RunPipelineStatusCB()); |
| 281 EXPECT_CALL(*mocks_->video_renderer(), Play(_)) | 288 EXPECT_CALL(*mocks_->video_renderer(), Play(_)) |
| 282 .WillOnce(RunClosure()); | 289 .WillOnce(RunClosure()); |
| 283 } | 290 } |
| 284 | 291 |
| 292 EXPECT_CALL(callbacks_, OnReadyState(Pipeline::kHaveEnoughData)); |
| 293 |
| 285 // We expect a successful seek callback. | 294 // We expect a successful seek callback. |
| 286 EXPECT_CALL(callbacks_, OnSeek(PIPELINE_OK)); | 295 EXPECT_CALL(callbacks_, OnSeek(PIPELINE_OK)); |
| 287 } | 296 } |
| 288 | 297 |
| 289 void DoSeek(const base::TimeDelta& seek_time) { | 298 void DoSeek(const base::TimeDelta& seek_time) { |
| 290 pipeline_->Seek(seek_time, | 299 pipeline_->Seek(seek_time, |
| 291 base::Bind(&CallbackHelper::OnSeek, | 300 base::Bind(&CallbackHelper::OnSeek, |
| 292 base::Unretained(&callbacks_))); | 301 base::Unretained(&callbacks_))); |
| 293 | 302 |
| 294 // We expect the time to be updated only after the seek has completed. | 303 // We expect the time to be updated only after the seek has completed. |
| 295 EXPECT_NE(seek_time, pipeline_->GetMediaTime()); | 304 EXPECT_NE(seek_time, pipeline_->GetMediaTime()); |
| 296 message_loop_.RunAllPending(); | 305 message_loop_.RunAllPending(); |
| 297 EXPECT_EQ(seek_time, pipeline_->GetMediaTime()); | 306 EXPECT_EQ(seek_time, pipeline_->GetMediaTime()); |
| 298 } | 307 } |
| 299 | 308 |
| 300 // Fixture members. | 309 // Fixture members. |
| 301 StrictMock<CallbackHelper> callbacks_; | 310 StrictMock<CallbackHelper> callbacks_; |
| 302 MessageLoop message_loop_; | 311 MessageLoop message_loop_; |
| 303 scoped_refptr<Pipeline> pipeline_; | 312 scoped_refptr<Pipeline> pipeline_; |
| 304 scoped_ptr<media::MockFilterCollection> mocks_; | 313 scoped_ptr<media::MockFilterCollection> mocks_; |
| 305 scoped_refptr<StrictMock<MockDemuxerStream> > audio_stream_; | 314 scoped_refptr<StrictMock<MockDemuxerStream> > audio_stream_; |
| 306 scoped_refptr<StrictMock<MockDemuxerStream> > video_stream_; | 315 scoped_refptr<StrictMock<MockDemuxerStream> > video_stream_; |
| 307 AudioRenderer::TimeCB audio_time_cb_; | 316 AudioRenderer::TimeCB audio_time_cb_; |
| 317 VideoDecoderConfig video_decoder_config_; |
| 308 | 318 |
| 309 private: | 319 private: |
| 310 DISALLOW_COPY_AND_ASSIGN(PipelineTest); | 320 DISALLOW_COPY_AND_ASSIGN(PipelineTest); |
| 311 }; | 321 }; |
| 312 | 322 |
| 313 // Test that playback controls methods no-op when the pipeline hasn't been | 323 // Test that playback controls methods no-op when the pipeline hasn't been |
| 314 // started. | 324 // started. |
| 315 TEST_F(PipelineTest, NotStarted) { | 325 TEST_F(PipelineTest, NotStarted) { |
| 316 const base::TimeDelta kZero; | 326 const base::TimeDelta kZero; |
| 317 | 327 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 // Don't execute the callback passed into Initialize(). | 360 // Don't execute the callback passed into Initialize(). |
| 351 EXPECT_CALL(*mocks_->demuxer(), Initialize(_, _)); | 361 EXPECT_CALL(*mocks_->demuxer(), Initialize(_, _)); |
| 352 | 362 |
| 353 // This test hangs during initialization by never calling | 363 // This test hangs during initialization by never calling |
| 354 // InitializationComplete(). StrictMock<> will ensure that the callback is | 364 // InitializationComplete(). StrictMock<> will ensure that the callback is |
| 355 // never executed. | 365 // never executed. |
| 356 pipeline_->Start( | 366 pipeline_->Start( |
| 357 mocks_->Create().Pass(), | 367 mocks_->Create().Pass(), |
| 358 base::Bind(&CallbackHelper::OnEnded, base::Unretained(&callbacks_)), | 368 base::Bind(&CallbackHelper::OnEnded, base::Unretained(&callbacks_)), |
| 359 base::Bind(&CallbackHelper::OnError, base::Unretained(&callbacks_)), | 369 base::Bind(&CallbackHelper::OnError, base::Unretained(&callbacks_)), |
| 360 base::Bind(&CallbackHelper::OnStart, base::Unretained(&callbacks_))); | 370 base::Bind(&CallbackHelper::OnStart, base::Unretained(&callbacks_)), |
| 371 base::Bind(&CallbackHelper::OnReadyState, |
| 372 base::Unretained(&callbacks_))); |
| 361 message_loop_.RunAllPending(); | 373 message_loop_.RunAllPending(); |
| 362 | 374 |
| 363 | 375 |
| 364 // Because our callback will get executed when the test tears down, we'll | 376 // Because our callback will get executed when the test tears down, we'll |
| 365 // verify that nothing has been called, then set our expectation for the call | 377 // verify that nothing has been called, then set our expectation for the call |
| 366 // made during tear down. | 378 // made during tear down. |
| 367 Mock::VerifyAndClear(&callbacks_); | 379 Mock::VerifyAndClear(&callbacks_); |
| 368 EXPECT_CALL(callbacks_, OnStart(PIPELINE_OK)); | 380 EXPECT_CALL(callbacks_, OnStart(PIPELINE_OK)); |
| 369 } | 381 } |
| 370 | 382 |
| 371 TEST_F(PipelineTest, RequiredFilterMissing) { | 383 TEST_F(PipelineTest, RequiredFilterMissing) { |
| 372 // Create a filter collection with missing filter. | 384 // Create a filter collection with missing filter. |
| 373 scoped_ptr<FilterCollection> collection(mocks_->Create()); | 385 scoped_ptr<FilterCollection> collection(mocks_->Create()); |
| 374 collection->SetDemuxer(NULL); | 386 collection->SetDemuxer(NULL); |
| 375 | 387 |
| 376 EXPECT_CALL(callbacks_, OnStart(PIPELINE_ERROR_REQUIRED_FILTER_MISSING)); | 388 EXPECT_CALL(callbacks_, OnStart(PIPELINE_ERROR_REQUIRED_FILTER_MISSING)); |
| 377 pipeline_->Start( | 389 pipeline_->Start( |
| 378 collection.Pass(), | 390 collection.Pass(), |
| 379 base::Bind(&CallbackHelper::OnEnded, base::Unretained(&callbacks_)), | 391 base::Bind(&CallbackHelper::OnEnded, base::Unretained(&callbacks_)), |
| 380 base::Bind(&CallbackHelper::OnError, base::Unretained(&callbacks_)), | 392 base::Bind(&CallbackHelper::OnError, base::Unretained(&callbacks_)), |
| 381 base::Bind(&CallbackHelper::OnStart, base::Unretained(&callbacks_))); | 393 base::Bind(&CallbackHelper::OnStart, base::Unretained(&callbacks_)), |
| 394 base::Bind(&CallbackHelper::OnReadyState, |
| 395 base::Unretained(&callbacks_))); |
| 382 message_loop_.RunAllPending(); | 396 message_loop_.RunAllPending(); |
| 383 } | 397 } |
| 384 | 398 |
| 385 TEST_F(PipelineTest, URLNotFound) { | 399 TEST_F(PipelineTest, URLNotFound) { |
| 386 EXPECT_CALL(*mocks_->demuxer(), Initialize(_, _)) | 400 EXPECT_CALL(*mocks_->demuxer(), Initialize(_, _)) |
| 387 .WillOnce(RunPipelineStatusCBWithStatus(PIPELINE_ERROR_URL_NOT_FOUND)); | 401 .WillOnce(RunPipelineStatusCBWithStatus(PIPELINE_ERROR_URL_NOT_FOUND)); |
| 388 EXPECT_CALL(*mocks_->demuxer(), Stop(_)) | 402 EXPECT_CALL(*mocks_->demuxer(), Stop(_)) |
| 389 .WillOnce(RunClosure()); | 403 .WillOnce(RunClosure()); |
| 390 | 404 |
| 391 InitializePipeline(PIPELINE_ERROR_URL_NOT_FOUND); | 405 InitializePipeline(PIPELINE_ERROR_URL_NOT_FOUND); |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 | 862 |
| 849 EXPECT_CALL(*mocks_->audio_renderer(), Pause(_)) | 863 EXPECT_CALL(*mocks_->audio_renderer(), Pause(_)) |
| 850 .WillOnce(RunClosure()); | 864 .WillOnce(RunClosure()); |
| 851 EXPECT_CALL(*mocks_->audio_renderer(), Flush(_)) | 865 EXPECT_CALL(*mocks_->audio_renderer(), Flush(_)) |
| 852 .WillOnce(RunClosure()); | 866 .WillOnce(RunClosure()); |
| 853 EXPECT_CALL(*mocks_->audio_renderer(), Preroll(seek_time, _)) | 867 EXPECT_CALL(*mocks_->audio_renderer(), Preroll(seek_time, _)) |
| 854 .WillOnce(RunPipelineStatusCB()); | 868 .WillOnce(RunPipelineStatusCB()); |
| 855 EXPECT_CALL(*mocks_->audio_renderer(), Play(_)) | 869 EXPECT_CALL(*mocks_->audio_renderer(), Play(_)) |
| 856 .WillOnce(RunClosure()); | 870 .WillOnce(RunClosure()); |
| 857 | 871 |
| 872 EXPECT_CALL(callbacks_, OnReadyState(Pipeline::kHaveEnoughData)); |
| 858 EXPECT_CALL(callbacks_, OnSeek(PIPELINE_OK)); | 873 EXPECT_CALL(callbacks_, OnSeek(PIPELINE_OK)); |
| 859 DoSeek(seek_time); | 874 DoSeek(seek_time); |
| 860 | 875 |
| 861 EXPECT_EQ(pipeline_->GetMediaTime(), seek_time); | 876 EXPECT_EQ(pipeline_->GetMediaTime(), seek_time); |
| 862 | 877 |
| 863 // Now that the seek is complete, verify that time updates advance the current | 878 // Now that the seek is complete, verify that time updates advance the current |
| 864 // time. | 879 // time. |
| 865 base::TimeDelta new_time = seek_time + base::TimeDelta::FromMilliseconds(100); | 880 base::TimeDelta new_time = seek_time + base::TimeDelta::FromMilliseconds(100); |
| 866 audio_time_cb_.Run(new_time, new_time); | 881 audio_time_cb_.Run(new_time, new_time); |
| 867 | 882 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 // see http://crbug.com/110228 | 1007 // see http://crbug.com/110228 |
| 993 void DoInitialize(TeardownState state, StopOrError stop_or_error) { | 1008 void DoInitialize(TeardownState state, StopOrError stop_or_error) { |
| 994 PipelineStatus expected_status = | 1009 PipelineStatus expected_status = |
| 995 SetInitializeExpectations(state, stop_or_error); | 1010 SetInitializeExpectations(state, stop_or_error); |
| 996 | 1011 |
| 997 EXPECT_CALL(callbacks_, OnStart(expected_status)); | 1012 EXPECT_CALL(callbacks_, OnStart(expected_status)); |
| 998 pipeline_->Start( | 1013 pipeline_->Start( |
| 999 mocks_->Create().Pass(), | 1014 mocks_->Create().Pass(), |
| 1000 base::Bind(&CallbackHelper::OnEnded, base::Unretained(&callbacks_)), | 1015 base::Bind(&CallbackHelper::OnEnded, base::Unretained(&callbacks_)), |
| 1001 base::Bind(&CallbackHelper::OnError, base::Unretained(&callbacks_)), | 1016 base::Bind(&CallbackHelper::OnError, base::Unretained(&callbacks_)), |
| 1002 base::Bind(&CallbackHelper::OnStart, base::Unretained(&callbacks_))); | 1017 base::Bind(&CallbackHelper::OnStart, base::Unretained(&callbacks_)), |
| 1018 base::Bind(&CallbackHelper::OnReadyState, |
| 1019 base::Unretained(&callbacks_))); |
| 1003 message_loop_.RunAllPending(); | 1020 message_loop_.RunAllPending(); |
| 1004 } | 1021 } |
| 1005 | 1022 |
| 1006 PipelineStatus SetInitializeExpectations(TeardownState state, | 1023 PipelineStatus SetInitializeExpectations(TeardownState state, |
| 1007 StopOrError stop_or_error) { | 1024 StopOrError stop_or_error) { |
| 1008 PipelineStatus status = PIPELINE_OK; | 1025 PipelineStatus status = PIPELINE_OK; |
| 1009 base::Closure stop_cb = base::Bind( | 1026 base::Closure stop_cb = base::Bind( |
| 1010 &CallbackHelper::OnStop, base::Unretained(&callbacks_)); | 1027 &CallbackHelper::OnStop, base::Unretained(&callbacks_)); |
| 1011 | 1028 |
| 1012 if (state == kInitDemuxer) { | 1029 if (state == kInitDemuxer) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1084 EXPECT_CALL(*mocks_->demuxer(), Stop(_)).WillOnce(RunClosure()); | 1101 EXPECT_CALL(*mocks_->demuxer(), Stop(_)).WillOnce(RunClosure()); |
| 1085 EXPECT_CALL(*mocks_->audio_renderer(), Stop(_)).WillOnce(RunClosure()); | 1102 EXPECT_CALL(*mocks_->audio_renderer(), Stop(_)).WillOnce(RunClosure()); |
| 1086 EXPECT_CALL(*mocks_->video_renderer(), Stop(_)).WillOnce(RunClosure()); | 1103 EXPECT_CALL(*mocks_->video_renderer(), Stop(_)).WillOnce(RunClosure()); |
| 1087 return status; | 1104 return status; |
| 1088 } | 1105 } |
| 1089 | 1106 |
| 1090 EXPECT_CALL(*mocks_->video_renderer(), | 1107 EXPECT_CALL(*mocks_->video_renderer(), |
| 1091 Initialize(_, _, _, _, _, _, _, _, _, _)) | 1108 Initialize(_, _, _, _, _, _, _, _, _, _)) |
| 1092 .WillOnce(RunPipelineStatusCB2()); | 1109 .WillOnce(RunPipelineStatusCB2()); |
| 1093 | 1110 |
| 1111 EXPECT_CALL(callbacks_, OnReadyState(Pipeline::kHaveMetadata)); |
| 1112 |
| 1094 // If we get here it's a successful initialization. | 1113 // If we get here it's a successful initialization. |
| 1095 EXPECT_CALL(*mocks_->demuxer(), SetPlaybackRate(0.0f)); | 1114 EXPECT_CALL(*mocks_->demuxer(), SetPlaybackRate(0.0f)); |
| 1096 EXPECT_CALL(*mocks_->audio_renderer(), SetPlaybackRate(0.0f)); | 1115 EXPECT_CALL(*mocks_->audio_renderer(), SetPlaybackRate(0.0f)); |
| 1097 EXPECT_CALL(*mocks_->video_renderer(), SetPlaybackRate(0.0f)); | 1116 EXPECT_CALL(*mocks_->video_renderer(), SetPlaybackRate(0.0f)); |
| 1098 | 1117 |
| 1099 EXPECT_CALL(*mocks_->audio_renderer(), SetVolume(1.0f)); | 1118 EXPECT_CALL(*mocks_->audio_renderer(), SetVolume(1.0f)); |
| 1100 | 1119 |
| 1101 EXPECT_CALL(*mocks_->audio_renderer(), Preroll(base::TimeDelta(), _)) | 1120 EXPECT_CALL(*mocks_->audio_renderer(), Preroll(base::TimeDelta(), _)) |
| 1102 .WillOnce(RunPipelineStatusCB()); | 1121 .WillOnce(RunPipelineStatusCB()); |
| 1103 EXPECT_CALL(*mocks_->video_renderer(), Preroll(base::TimeDelta(), _)) | 1122 EXPECT_CALL(*mocks_->video_renderer(), Preroll(base::TimeDelta(), _)) |
| 1104 .WillOnce(RunPipelineStatusCB()); | 1123 .WillOnce(RunPipelineStatusCB()); |
| 1105 | 1124 |
| 1106 EXPECT_CALL(*mocks_->audio_renderer(), Play(_)) | 1125 EXPECT_CALL(*mocks_->audio_renderer(), Play(_)) |
| 1107 .WillOnce(RunClosure()); | 1126 .WillOnce(RunClosure()); |
| 1108 EXPECT_CALL(*mocks_->video_renderer(), Play(_)) | 1127 EXPECT_CALL(*mocks_->video_renderer(), Play(_)) |
| 1109 .WillOnce(RunClosure()); | 1128 .WillOnce(RunClosure()); |
| 1110 | 1129 |
| 1130 if (status == PIPELINE_OK) |
| 1131 EXPECT_CALL(callbacks_, OnReadyState(Pipeline::kHaveEnoughData)); |
| 1132 |
| 1111 return status; | 1133 return status; |
| 1112 } | 1134 } |
| 1113 | 1135 |
| 1114 void ExpectSeekStop(TeardownState state) { | 1136 void ExpectSeekStop(TeardownState state) { |
| 1115 base::Closure stop_cb = base::Bind( | 1137 base::Closure stop_cb = base::Bind( |
| 1116 &CallbackHelper::OnStop, base::Unretained(&callbacks_)); | 1138 &CallbackHelper::OnStop, base::Unretained(&callbacks_)); |
| 1117 | 1139 |
| 1118 if (state == kPausing) { | 1140 if (state == kPausing) { |
| 1119 EXPECT_CALL(*mocks_->audio_renderer(), Pause(_)) | 1141 EXPECT_CALL(*mocks_->audio_renderer(), Pause(_)) |
| 1120 .WillOnce(DoAll(Stop(pipeline_, stop_cb), RunClosure())); | 1142 .WillOnce(DoAll(Stop(pipeline_, stop_cb), RunClosure())); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 | 1176 |
| 1155 if (state == kStarting) { | 1177 if (state == kStarting) { |
| 1156 EXPECT_CALL(*mocks_->audio_renderer(), Play(_)) | 1178 EXPECT_CALL(*mocks_->audio_renderer(), Play(_)) |
| 1157 .WillOnce(DoAll(Stop(pipeline_, stop_cb), RunClosure())); | 1179 .WillOnce(DoAll(Stop(pipeline_, stop_cb), RunClosure())); |
| 1158 } else { | 1180 } else { |
| 1159 EXPECT_CALL(*mocks_->audio_renderer(), Play(_)).WillOnce(RunClosure()); | 1181 EXPECT_CALL(*mocks_->audio_renderer(), Play(_)).WillOnce(RunClosure()); |
| 1160 } | 1182 } |
| 1161 | 1183 |
| 1162 EXPECT_CALL(*mocks_->video_renderer(), Play(_)).WillOnce(RunClosure()); | 1184 EXPECT_CALL(*mocks_->video_renderer(), Play(_)).WillOnce(RunClosure()); |
| 1163 | 1185 |
| 1186 EXPECT_CALL(callbacks_, OnReadyState(Pipeline::kHaveEnoughData)); |
| 1164 EXPECT_CALL(callbacks_, OnSeek(PIPELINE_OK)); | 1187 EXPECT_CALL(callbacks_, OnSeek(PIPELINE_OK)); |
| 1165 ExpectStop(); | 1188 ExpectStop(); |
| 1166 } | 1189 } |
| 1167 | 1190 |
| 1168 void ExpectSeekError(TeardownState state) { | 1191 void ExpectSeekError(TeardownState state) { |
| 1169 SetSeekErrorExpectations(state); | 1192 SetSeekErrorExpectations(state); |
| 1170 | 1193 |
| 1171 // Executed after the error is raised. | 1194 // Executed after the error is raised. |
| 1172 EXPECT_CALL(callbacks_, OnSeek(PIPELINE_ERROR_READ)); | 1195 EXPECT_CALL(callbacks_, OnSeek(PIPELINE_ERROR_READ)); |
| 1173 EXPECT_CALL(*mocks_->demuxer(), Stop(_)).WillOnce(RunClosure()); | 1196 EXPECT_CALL(*mocks_->demuxer(), Stop(_)).WillOnce(RunClosure()); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1296 INSTANTIATE_TEARDOWN_TEST(Error, InitAudioRenderer); | 1319 INSTANTIATE_TEARDOWN_TEST(Error, InitAudioRenderer); |
| 1297 INSTANTIATE_TEARDOWN_TEST(Error, InitVideoRenderer); | 1320 INSTANTIATE_TEARDOWN_TEST(Error, InitVideoRenderer); |
| 1298 INSTANTIATE_TEARDOWN_TEST(Error, Pausing); | 1321 INSTANTIATE_TEARDOWN_TEST(Error, Pausing); |
| 1299 INSTANTIATE_TEARDOWN_TEST(Error, Flushing); | 1322 INSTANTIATE_TEARDOWN_TEST(Error, Flushing); |
| 1300 INSTANTIATE_TEARDOWN_TEST(Error, Seeking); | 1323 INSTANTIATE_TEARDOWN_TEST(Error, Seeking); |
| 1301 INSTANTIATE_TEARDOWN_TEST(Error, Prerolling); | 1324 INSTANTIATE_TEARDOWN_TEST(Error, Prerolling); |
| 1302 INSTANTIATE_TEARDOWN_TEST(Error, Starting); | 1325 INSTANTIATE_TEARDOWN_TEST(Error, Starting); |
| 1303 INSTANTIATE_TEARDOWN_TEST(Error, Playing); | 1326 INSTANTIATE_TEARDOWN_TEST(Error, Playing); |
| 1304 | 1327 |
| 1305 } // namespace media | 1328 } // namespace media |
| OLD | NEW |