| 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" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/strings/string_split.h" | 14 #include "base/strings/string_split.h" |
| 15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 16 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
| 17 #include "base/test/simple_test_tick_clock.h" | 17 #include "base/test/simple_test_tick_clock.h" |
| 18 #include "media/base/data_buffer.h" | 18 #include "media/base/data_buffer.h" |
| 19 #include "media/base/gmock_callback_support.h" | 19 #include "media/base/gmock_callback_support.h" |
| 20 #include "media/base/limits.h" | 20 #include "media/base/limits.h" |
| 21 #include "media/base/mock_filters.h" | 21 #include "media/base/mock_filters.h" |
| 22 #include "media/base/null_video_sink.h" |
| 22 #include "media/base/test_helpers.h" | 23 #include "media/base/test_helpers.h" |
| 23 #include "media/base/video_frame.h" | 24 #include "media/base/video_frame.h" |
| 24 #include "media/renderers/video_renderer_impl.h" | 25 #include "media/renderers/video_renderer_impl.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
| 26 | 27 |
| 27 using ::testing::_; | 28 using ::testing::_; |
| 28 using ::testing::AnyNumber; | 29 using ::testing::AnyNumber; |
| 29 using ::testing::Invoke; | 30 using ::testing::Invoke; |
| 30 using ::testing::Mock; | 31 using ::testing::Mock; |
| 31 using ::testing::NiceMock; | 32 using ::testing::NiceMock; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 46 | 47 |
| 47 class VideoRendererImplTest : public ::testing::Test { | 48 class VideoRendererImplTest : public ::testing::Test { |
| 48 public: | 49 public: |
| 49 VideoRendererImplTest() | 50 VideoRendererImplTest() |
| 50 : tick_clock_(new base::SimpleTestTickClock()), | 51 : tick_clock_(new base::SimpleTestTickClock()), |
| 51 decoder_(new MockVideoDecoder()), | 52 decoder_(new MockVideoDecoder()), |
| 52 demuxer_stream_(DemuxerStream::VIDEO) { | 53 demuxer_stream_(DemuxerStream::VIDEO) { |
| 53 ScopedVector<VideoDecoder> decoders; | 54 ScopedVector<VideoDecoder> decoders; |
| 54 decoders.push_back(decoder_); | 55 decoders.push_back(decoder_); |
| 55 | 56 |
| 56 renderer_.reset(new VideoRendererImpl(message_loop_.message_loop_proxy(), | 57 // Since the Underflow test needs a render interval shorter than the frame |
| 57 &mock_cb_, | 58 // duration, use 120Hz (which makes each interval is < 10ms; ~9.9ms). |
| 58 decoders.Pass(), true, | 59 null_video_sink_.reset(new NullVideoSink( |
| 59 new MediaLog())); | 60 false, base::TimeDelta::FromSecondsD(1.0 / 120), |
| 61 base::Bind(&MockCB::FrameReceived, base::Unretained(&mock_cb_)), |
| 62 message_loop_.task_runner())); |
| 63 |
| 64 renderer_.reset(new VideoRendererImpl( |
| 65 message_loop_.message_loop_proxy(), null_video_sink_.get(), |
| 66 decoders.Pass(), true, new MediaLog())); |
| 67 |
| 60 renderer_->SetTickClockForTesting(scoped_ptr<base::TickClock>(tick_clock_)); | 68 renderer_->SetTickClockForTesting(scoped_ptr<base::TickClock>(tick_clock_)); |
| 69 null_video_sink_->set_tick_clock_for_testing(tick_clock_); |
| 61 | 70 |
| 62 // Start wallclock time at a non-zero value. | 71 // Start wallclock time at a non-zero value. |
| 63 AdvanceWallclockTimeInMs(12345); | 72 AdvanceWallclockTimeInMs(12345); |
| 64 | 73 |
| 65 demuxer_stream_.set_video_decoder_config(TestVideoConfig::Normal()); | 74 demuxer_stream_.set_video_decoder_config(TestVideoConfig::Normal()); |
| 66 | 75 |
| 67 // We expect these to be called but we don't care how/when. | 76 // We expect these to be called but we don't care how/when. |
| 68 EXPECT_CALL(demuxer_stream_, Read(_)).WillRepeatedly( | 77 EXPECT_CALL(demuxer_stream_, Read(_)).WillRepeatedly( |
| 69 RunCallback<0>(DemuxerStream::kOk, | 78 RunCallback<0>(DemuxerStream::kOk, |
| 70 scoped_refptr<DecoderBuffer>(new DecoderBuffer(0)))); | 79 scoped_refptr<DecoderBuffer>(new DecoderBuffer(0)))); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 } | 267 } |
| 259 | 268 |
| 260 protected: | 269 protected: |
| 261 // Fixture members. | 270 // Fixture members. |
| 262 scoped_ptr<VideoRendererImpl> renderer_; | 271 scoped_ptr<VideoRendererImpl> renderer_; |
| 263 base::SimpleTestTickClock* tick_clock_; // Owned by |renderer_|. | 272 base::SimpleTestTickClock* tick_clock_; // Owned by |renderer_|. |
| 264 MockVideoDecoder* decoder_; // Owned by |renderer_|. | 273 MockVideoDecoder* decoder_; // Owned by |renderer_|. |
| 265 NiceMock<MockDemuxerStream> demuxer_stream_; | 274 NiceMock<MockDemuxerStream> demuxer_stream_; |
| 266 | 275 |
| 267 // Use StrictMock<T> to catch missing/extra callbacks. | 276 // Use StrictMock<T> to catch missing/extra callbacks. |
| 268 // TODO(dalecurtis): Mocks won't be useful for the new rendering path, we'll | 277 class MockCB { |
| 269 // need fake callback generators like we have for the audio path. | |
| 270 // http://crbug.com/473424 | |
| 271 class MockCB : public VideoRendererSink { | |
| 272 public: | 278 public: |
| 273 MOCK_METHOD1(Start, void(VideoRendererSink::RenderCallback*)); | 279 MOCK_METHOD1(FrameReceived, void(const scoped_refptr<VideoFrame>&)); |
| 274 MOCK_METHOD0(Stop, void()); | |
| 275 MOCK_METHOD1(PaintFrameUsingOldRenderingPath, | |
| 276 void(const scoped_refptr<VideoFrame>&)); | |
| 277 MOCK_METHOD1(BufferingStateChange, void(BufferingState)); | 280 MOCK_METHOD1(BufferingStateChange, void(BufferingState)); |
| 278 }; | 281 }; |
| 279 StrictMock<MockCB> mock_cb_; | 282 StrictMock<MockCB> mock_cb_; |
| 280 | 283 |
| 284 // Must be destroyed before |renderer_| since they share |tick_clock_|. |
| 285 scoped_ptr<NullVideoSink> null_video_sink_; |
| 286 |
| 281 private: | 287 private: |
| 282 base::TimeTicks GetWallClockTime(base::TimeDelta time) { | 288 base::TimeTicks GetWallClockTime(base::TimeDelta time) { |
| 283 base::AutoLock l(lock_); | 289 base::AutoLock l(lock_); |
| 284 return tick_clock_->NowTicks() + (time - time_); | 290 return tick_clock_->NowTicks() + (time - time_); |
| 285 } | 291 } |
| 286 | 292 |
| 287 void DecodeRequested(const scoped_refptr<DecoderBuffer>& buffer, | 293 void DecodeRequested(const scoped_refptr<DecoderBuffer>& buffer, |
| 288 const VideoDecoder::DecodeCB& decode_cb) { | 294 const VideoDecoder::DecodeCB& decode_cb) { |
| 289 DCHECK_EQ(&message_loop_, base::MessageLoop::current()); | 295 DCHECK_EQ(&message_loop_, base::MessageLoop::current()); |
| 290 CHECK(decode_cb_.is_null()); | 296 CHECK(decode_cb_.is_null()); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 } | 354 } |
| 349 | 355 |
| 350 TEST_F(VideoRendererImplTest, Initialize) { | 356 TEST_F(VideoRendererImplTest, Initialize) { |
| 351 Initialize(); | 357 Initialize(); |
| 352 Destroy(); | 358 Destroy(); |
| 353 } | 359 } |
| 354 | 360 |
| 355 TEST_F(VideoRendererImplTest, InitializeAndStartPlayingFrom) { | 361 TEST_F(VideoRendererImplTest, InitializeAndStartPlayingFrom) { |
| 356 Initialize(); | 362 Initialize(); |
| 357 QueueFrames("0 10 20 30"); | 363 QueueFrames("0 10 20 30"); |
| 358 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); | 364 EXPECT_CALL(mock_cb_, FrameReceived(HasTimestamp(0))); |
| 359 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); | 365 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
| 360 StartPlayingFrom(0); | 366 StartPlayingFrom(0); |
| 361 Destroy(); | 367 Destroy(); |
| 362 } | 368 } |
| 363 | 369 |
| 364 TEST_F(VideoRendererImplTest, DestroyWhileInitializing) { | 370 TEST_F(VideoRendererImplTest, DestroyWhileInitializing) { |
| 365 CallInitialize(NewExpectedStatusCB(PIPELINE_ERROR_ABORT), false, PIPELINE_OK); | 371 CallInitialize(NewExpectedStatusCB(PIPELINE_ERROR_ABORT), false, PIPELINE_OK); |
| 366 Destroy(); | 372 Destroy(); |
| 367 } | 373 } |
| 368 | 374 |
| 369 TEST_F(VideoRendererImplTest, DestroyWhileFlushing) { | 375 TEST_F(VideoRendererImplTest, DestroyWhileFlushing) { |
| 370 Initialize(); | 376 Initialize(); |
| 371 QueueFrames("0 10 20 30"); | 377 QueueFrames("0 10 20 30"); |
| 372 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); | 378 EXPECT_CALL(mock_cb_, FrameReceived(HasTimestamp(0))); |
| 373 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); | 379 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
| 374 StartPlayingFrom(0); | 380 StartPlayingFrom(0); |
| 375 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_NOTHING)); | 381 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_NOTHING)); |
| 376 renderer_->Flush(NewExpectedClosure()); | 382 renderer_->Flush(NewExpectedClosure()); |
| 377 Destroy(); | 383 Destroy(); |
| 378 } | 384 } |
| 379 | 385 |
| 380 TEST_F(VideoRendererImplTest, Play) { | 386 TEST_F(VideoRendererImplTest, Play) { |
| 381 Initialize(); | 387 Initialize(); |
| 382 QueueFrames("0 10 20 30"); | 388 QueueFrames("0 10 20 30"); |
| 383 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); | 389 EXPECT_CALL(mock_cb_, FrameReceived(HasTimestamp(0))); |
| 384 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); | 390 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
| 385 StartPlayingFrom(0); | 391 StartPlayingFrom(0); |
| 386 Destroy(); | 392 Destroy(); |
| 387 } | 393 } |
| 388 | 394 |
| 389 TEST_F(VideoRendererImplTest, FlushWithNothingBuffered) { | 395 TEST_F(VideoRendererImplTest, FlushWithNothingBuffered) { |
| 390 Initialize(); | 396 Initialize(); |
| 391 StartPlayingFrom(0); | 397 StartPlayingFrom(0); |
| 392 | 398 |
| 393 // We shouldn't expect a buffering state change since we never reached | 399 // We shouldn't expect a buffering state change since we never reached |
| 394 // BUFFERING_HAVE_ENOUGH. | 400 // BUFFERING_HAVE_ENOUGH. |
| 395 Flush(); | 401 Flush(); |
| 396 Destroy(); | 402 Destroy(); |
| 397 } | 403 } |
| 398 | 404 |
| 399 TEST_F(VideoRendererImplTest, DecodeError_Playing) { | 405 TEST_F(VideoRendererImplTest, DecodeError_Playing) { |
| 400 Initialize(); | 406 Initialize(); |
| 401 QueueFrames("0 10 20 30"); | 407 QueueFrames("0 10 20 30"); |
| 402 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); | 408 EXPECT_CALL(mock_cb_, FrameReceived(_)).Times(testing::AtLeast(1)); |
| 403 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); | 409 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
| 404 StartPlayingFrom(0); | 410 StartPlayingFrom(0); |
| 405 | 411 |
| 412 WaitForPendingRead(); |
| 413 |
| 406 QueueFrames("error"); | 414 QueueFrames("error"); |
| 407 SatisfyPendingRead(); | 415 SatisfyPendingRead(); |
| 408 WaitForError(PIPELINE_ERROR_DECODE); | 416 WaitForError(PIPELINE_ERROR_DECODE); |
| 409 Destroy(); | 417 Destroy(); |
| 410 } | 418 } |
| 411 | 419 |
| 412 TEST_F(VideoRendererImplTest, DecodeError_DuringStartPlayingFrom) { | 420 TEST_F(VideoRendererImplTest, DecodeError_DuringStartPlayingFrom) { |
| 413 Initialize(); | 421 Initialize(); |
| 414 QueueFrames("error"); | 422 QueueFrames("error"); |
| 415 StartPlayingFrom(0); | 423 StartPlayingFrom(0); |
| 416 Destroy(); | 424 Destroy(); |
| 417 } | 425 } |
| 418 | 426 |
| 419 TEST_F(VideoRendererImplTest, StartPlayingFrom_Exact) { | 427 TEST_F(VideoRendererImplTest, StartPlayingFrom_Exact) { |
| 420 Initialize(); | 428 Initialize(); |
| 421 QueueFrames("50 60 70 80 90"); | 429 QueueFrames("50 60 70 80 90"); |
| 422 | 430 |
| 423 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(60))); | 431 EXPECT_CALL(mock_cb_, FrameReceived(HasTimestamp(60))); |
| 424 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); | 432 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
| 425 StartPlayingFrom(60); | 433 StartPlayingFrom(60); |
| 426 Destroy(); | 434 Destroy(); |
| 427 } | 435 } |
| 428 | 436 |
| 429 TEST_F(VideoRendererImplTest, StartPlayingFrom_RightBefore) { | 437 TEST_F(VideoRendererImplTest, StartPlayingFrom_RightBefore) { |
| 430 Initialize(); | 438 Initialize(); |
| 431 QueueFrames("50 60 70 80 90"); | 439 QueueFrames("50 60 70 80 90"); |
| 432 | 440 |
| 433 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(50))); | 441 EXPECT_CALL(mock_cb_, FrameReceived(HasTimestamp(50))); |
| 434 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); | 442 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
| 435 StartPlayingFrom(59); | 443 StartPlayingFrom(59); |
| 436 Destroy(); | 444 Destroy(); |
| 437 } | 445 } |
| 438 | 446 |
| 439 TEST_F(VideoRendererImplTest, StartPlayingFrom_RightAfter) { | 447 TEST_F(VideoRendererImplTest, StartPlayingFrom_RightAfter) { |
| 440 Initialize(); | 448 Initialize(); |
| 441 QueueFrames("50 60 70 80 90"); | 449 QueueFrames("50 60 70 80 90"); |
| 442 | 450 |
| 443 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(60))); | 451 EXPECT_CALL(mock_cb_, FrameReceived(HasTimestamp(60))); |
| 444 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); | 452 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
| 445 StartPlayingFrom(61); | 453 StartPlayingFrom(61); |
| 446 Destroy(); | 454 Destroy(); |
| 447 } | 455 } |
| 448 | 456 |
| 449 TEST_F(VideoRendererImplTest, StartPlayingFrom_LowDelay) { | 457 TEST_F(VideoRendererImplTest, StartPlayingFrom_LowDelay) { |
| 450 // In low-delay mode only one frame is required to finish preroll. | 458 // In low-delay mode only one frame is required to finish preroll. |
| 451 InitializeWithLowDelay(true); | 459 InitializeWithLowDelay(true); |
| 452 QueueFrames("0"); | 460 QueueFrames("0"); |
| 453 | 461 |
| 454 // Expect some amount of have enough/nothing due to only requiring one frame. | 462 // Expect some amount of have enough/nothing due to only requiring one frame. |
| 455 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); | 463 EXPECT_CALL(mock_cb_, FrameReceived(HasTimestamp(0))); |
| 456 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)) | 464 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)) |
| 457 .Times(AnyNumber()); | 465 .Times(AnyNumber()); |
| 458 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_NOTHING)) | 466 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_NOTHING)) |
| 459 .Times(AnyNumber()); | 467 .Times(AnyNumber()); |
| 460 StartPlayingFrom(0); | 468 StartPlayingFrom(0); |
| 461 | 469 |
| 462 QueueFrames("10"); | 470 QueueFrames("10"); |
| 463 SatisfyPendingRead(); | 471 SatisfyPendingRead(); |
| 464 | 472 |
| 465 WaitableMessageLoopEvent event; | 473 WaitableMessageLoopEvent event; |
| 466 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(10))) | 474 EXPECT_CALL(mock_cb_, FrameReceived(HasTimestamp(10))) |
| 467 .WillOnce(RunClosure(event.GetClosure())); | 475 .WillOnce(RunClosure(event.GetClosure())); |
| 468 AdvanceTimeInMs(10); | 476 AdvanceTimeInMs(10); |
| 469 event.RunAndWait(); | 477 event.RunAndWait(); |
| 470 | 478 |
| 471 Destroy(); | 479 Destroy(); |
| 472 } | 480 } |
| 473 | 481 |
| 474 // Verify that a late decoder response doesn't break invariants in the renderer. | 482 // Verify that a late decoder response doesn't break invariants in the renderer. |
| 475 TEST_F(VideoRendererImplTest, DestroyDuringOutstandingRead) { | 483 TEST_F(VideoRendererImplTest, DestroyDuringOutstandingRead) { |
| 476 Initialize(); | 484 Initialize(); |
| 477 QueueFrames("0 10 20 30"); | 485 QueueFrames("0 10 20 30"); |
| 478 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); | 486 EXPECT_CALL(mock_cb_, FrameReceived(HasTimestamp(0))); |
| 479 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); | 487 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
| 480 StartPlayingFrom(0); | 488 StartPlayingFrom(0); |
| 481 | 489 |
| 482 // Check that there is an outstanding Read() request. | 490 // Check that there is an outstanding Read() request. |
| 483 EXPECT_TRUE(IsReadPending()); | 491 EXPECT_TRUE(IsReadPending()); |
| 484 | 492 |
| 485 Destroy(); | 493 Destroy(); |
| 486 } | 494 } |
| 487 | 495 |
| 488 TEST_F(VideoRendererImplTest, VideoDecoder_InitFailure) { | 496 TEST_F(VideoRendererImplTest, VideoDecoder_InitFailure) { |
| 489 InitializeRenderer(DECODER_ERROR_NOT_SUPPORTED, false); | 497 InitializeRenderer(DECODER_ERROR_NOT_SUPPORTED, false); |
| 490 Destroy(); | 498 Destroy(); |
| 491 } | 499 } |
| 492 | 500 |
| 493 TEST_F(VideoRendererImplTest, Underflow) { | 501 TEST_F(VideoRendererImplTest, Underflow) { |
| 494 Initialize(); | 502 Initialize(); |
| 495 QueueFrames("0 10 20 30"); | 503 QueueFrames("0 10 20 30"); |
| 496 | 504 |
| 497 { | 505 { |
| 498 WaitableMessageLoopEvent event; | 506 WaitableMessageLoopEvent event; |
| 499 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); | 507 EXPECT_CALL(mock_cb_, FrameReceived(HasTimestamp(0))); |
| 500 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)) | 508 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)) |
| 501 .WillOnce(RunClosure(event.GetClosure())); | 509 .WillOnce(RunClosure(event.GetClosure())); |
| 502 StartPlayingFrom(0); | 510 StartPlayingFrom(0); |
| 503 event.RunAndWait(); | 511 event.RunAndWait(); |
| 504 Mock::VerifyAndClearExpectations(&mock_cb_); | 512 Mock::VerifyAndClearExpectations(&mock_cb_); |
| 505 } | 513 } |
| 506 | 514 |
| 507 // Advance time slightly, but enough to exceed the duration of the last frame. | 515 // Advance time slightly, but enough to exceed the duration of the last frame. |
| 508 // Frames should be dropped and we should NOT signal having nothing. | 516 // Frames should be dropped and we should NOT signal having nothing. |
| 509 { | 517 { |
| 510 SCOPED_TRACE("Waiting for frame drops"); | 518 SCOPED_TRACE("Waiting for frame drops"); |
| 511 WaitableMessageLoopEvent event; | 519 WaitableMessageLoopEvent event; |
| 512 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(10))) | 520 EXPECT_CALL(mock_cb_, FrameReceived(HasTimestamp(10))) |
| 513 .Times(0); | 521 .Times(0); |
| 514 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(20))) | 522 EXPECT_CALL(mock_cb_, FrameReceived(HasTimestamp(20))) |
| 515 .Times(0); | 523 .Times(0); |
| 516 EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(30))) | 524 EXPECT_CALL(mock_cb_, FrameReceived(HasTimestamp(30))) |
| 517 .WillOnce(RunClosure(event.GetClosure())); | 525 .WillOnce(RunClosure(event.GetClosure())); |
| 518 AdvanceTimeInMs(31); | 526 AdvanceTimeInMs(31); |
| 519 event.RunAndWait(); | 527 event.RunAndWait(); |
| 520 Mock::VerifyAndClearExpectations(&mock_cb_); | 528 Mock::VerifyAndClearExpectations(&mock_cb_); |
| 521 } | 529 } |
| 522 | 530 |
| 523 // Advance time more. Now we should signal having nothing. And put | 531 // Advance time more. Now we should signal having nothing. And put |
| 524 // the last frame up for display. | 532 // the last frame up for display. |
| 525 { | 533 { |
| 526 SCOPED_TRACE("Waiting for BUFFERING_HAVE_NOTHING"); | 534 SCOPED_TRACE("Waiting for BUFFERING_HAVE_NOTHING"); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 540 .WillOnce(RunClosure(event.GetClosure())); | 548 .WillOnce(RunClosure(event.GetClosure())); |
| 541 SatisfyPendingReadWithEndOfStream(); | 549 SatisfyPendingReadWithEndOfStream(); |
| 542 event.RunAndWait(); | 550 event.RunAndWait(); |
| 543 } | 551 } |
| 544 | 552 |
| 545 WaitForEnded(); | 553 WaitForEnded(); |
| 546 Destroy(); | 554 Destroy(); |
| 547 } | 555 } |
| 548 | 556 |
| 549 } // namespace media | 557 } // namespace media |
| OLD | NEW |