| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.h" | 8 #include "base/callback.h" |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/debug/stack_trace.h" | 10 #include "base/debug/stack_trace.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 event.RunAndWaitForStatus(expected); | 87 event.RunAndWaitForStatus(expected); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void CallInitialize(const PipelineStatusCB& status_cb, | 90 void CallInitialize(const PipelineStatusCB& status_cb, |
| 91 bool low_delay, | 91 bool low_delay, |
| 92 PipelineStatus decoder_status) { | 92 PipelineStatus decoder_status) { |
| 93 if (low_delay) | 93 if (low_delay) |
| 94 demuxer_stream_.set_liveness(DemuxerStream::LIVENESS_LIVE); | 94 demuxer_stream_.set_liveness(DemuxerStream::LIVENESS_LIVE); |
| 95 EXPECT_CALL(*decoder_, Initialize(_, _, _, _)).WillOnce( | 95 EXPECT_CALL(*decoder_, Initialize(_, _, _, _)).WillOnce( |
| 96 DoAll(SaveArg<3>(&output_cb_), RunCallback<2>(decoder_status))); | 96 DoAll(SaveArg<3>(&output_cb_), RunCallback<2>(decoder_status))); |
| 97 EXPECT_CALL(*this, OnWaitingForDecryptionKey()).Times(0); |
| 97 renderer_->Initialize( | 98 renderer_->Initialize( |
| 98 &demuxer_stream_, status_cb, media::SetDecryptorReadyCB(), | 99 &demuxer_stream_, status_cb, media::SetDecryptorReadyCB(), |
| 99 base::Bind(&VideoRendererImplTest::OnStatisticsUpdate, | 100 base::Bind(&VideoRendererImplTest::OnStatisticsUpdate, |
| 100 base::Unretained(this)), | 101 base::Unretained(this)), |
| 101 base::Bind(&StrictMock<MockCB>::BufferingStateChange, | 102 base::Bind(&StrictMock<MockCB>::BufferingStateChange, |
| 102 base::Unretained(&mock_cb_)), | 103 base::Unretained(&mock_cb_)), |
| 103 base::Bind(&StrictMock<MockCB>::Display, base::Unretained(&mock_cb_)), | 104 base::Bind(&StrictMock<MockCB>::Display, base::Unretained(&mock_cb_)), |
| 104 ended_event_.GetClosure(), error_event_.GetPipelineStatusCB(), | 105 ended_event_.GetClosure(), error_event_.GetPipelineStatusCB(), |
| 105 base::Bind(&VideoRendererImplTest::GetTime, base::Unretained(this))); | 106 base::Bind(&VideoRendererImplTest::GetTime, base::Unretained(this)), |
| 107 base::Bind(&VideoRendererImplTest::OnWaitingForDecryptionKey, |
| 108 base::Unretained(this))); |
| 106 } | 109 } |
| 107 | 110 |
| 108 void StartPlayingFrom(int milliseconds) { | 111 void StartPlayingFrom(int milliseconds) { |
| 109 SCOPED_TRACE(base::StringPrintf("StartPlayingFrom(%d)", milliseconds)); | 112 SCOPED_TRACE(base::StringPrintf("StartPlayingFrom(%d)", milliseconds)); |
| 110 renderer_->StartPlayingFrom( | 113 renderer_->StartPlayingFrom( |
| 111 base::TimeDelta::FromMilliseconds(milliseconds)); | 114 base::TimeDelta::FromMilliseconds(milliseconds)); |
| 112 message_loop_.RunUntilIdle(); | 115 message_loop_.RunUntilIdle(); |
| 113 } | 116 } |
| 114 | 117 |
| 115 void Flush() { | 118 void Flush() { |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 if (!decode_cb_.is_null()) { | 285 if (!decode_cb_.is_null()) { |
| 283 QueueFrames("abort"); | 286 QueueFrames("abort"); |
| 284 SatisfyPendingRead(); | 287 SatisfyPendingRead(); |
| 285 } | 288 } |
| 286 | 289 |
| 287 message_loop_.PostTask(FROM_HERE, callback); | 290 message_loop_.PostTask(FROM_HERE, callback); |
| 288 } | 291 } |
| 289 | 292 |
| 290 void OnStatisticsUpdate(const PipelineStatistics& stats) {} | 293 void OnStatisticsUpdate(const PipelineStatistics& stats) {} |
| 291 | 294 |
| 295 MOCK_METHOD0(OnWaitingForDecryptionKey, void(void)); |
| 296 |
| 292 base::MessageLoop message_loop_; | 297 base::MessageLoop message_loop_; |
| 293 | 298 |
| 294 // Used to protect |time_|. | 299 // Used to protect |time_|. |
| 295 base::Lock lock_; | 300 base::Lock lock_; |
| 296 base::TimeDelta time_; | 301 base::TimeDelta time_; |
| 297 | 302 |
| 298 // Used for satisfying reads. | 303 // Used for satisfying reads. |
| 299 VideoDecoder::OutputCB output_cb_; | 304 VideoDecoder::OutputCB output_cb_; |
| 300 VideoDecoder::DecodeCB decode_cb_; | 305 VideoDecoder::DecodeCB decode_cb_; |
| 301 base::TimeDelta next_frame_timestamp_; | 306 base::TimeDelta next_frame_timestamp_; |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 .WillOnce(RunClosure(event.GetClosure())); | 498 .WillOnce(RunClosure(event.GetClosure())); |
| 494 SatisfyPendingReadWithEndOfStream(); | 499 SatisfyPendingReadWithEndOfStream(); |
| 495 event.RunAndWait(); | 500 event.RunAndWait(); |
| 496 } | 501 } |
| 497 | 502 |
| 498 WaitForEnded(); | 503 WaitForEnded(); |
| 499 Destroy(); | 504 Destroy(); |
| 500 } | 505 } |
| 501 | 506 |
| 502 } // namespace media | 507 } // namespace media |
| OLD | NEW |