| 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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 } | 465 } |
| 466 | 466 |
| 467 TEST_F(VideoRendererImplTest, VideoDecoder_InitFailure) { | 467 TEST_F(VideoRendererImplTest, VideoDecoder_InitFailure) { |
| 468 InitializeRenderer(DECODER_ERROR_NOT_SUPPORTED, false); | 468 InitializeRenderer(DECODER_ERROR_NOT_SUPPORTED, false); |
| 469 Destroy(); | 469 Destroy(); |
| 470 } | 470 } |
| 471 | 471 |
| 472 TEST_F(VideoRendererImplTest, Underflow) { | 472 TEST_F(VideoRendererImplTest, Underflow) { |
| 473 Initialize(); | 473 Initialize(); |
| 474 QueueFrames("0 10 20 30"); | 474 QueueFrames("0 10 20 30"); |
| 475 EXPECT_CALL(mock_cb_, Display(HasTimestamp(0))); | 475 |
| 476 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); | 476 { |
| 477 StartPlayingFrom(0); | 477 WaitableMessageLoopEvent event; |
| 478 EXPECT_CALL(mock_cb_, Display(HasTimestamp(0))) |
| 479 .Times(1) |
| 480 .WillOnce(RunClosure(event.GetClosure())); |
| 481 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
| 482 StartPlayingFrom(0); |
| 483 event.RunAndWait(); |
| 484 } |
| 478 | 485 |
| 479 // Advance time slightly. Frames should be dropped and we should NOT signal | 486 // Advance time slightly. Frames should be dropped and we should NOT signal |
| 480 // having nothing. | 487 // having nothing. |
| 481 AdvanceTimeInMs(100); | 488 AdvanceTimeInMs(100); |
| 482 | 489 |
| 483 // Advance time more. Now we should signal having nothing. | 490 // Advance time more. Now we should signal having nothing. And put |
| 491 // the last frame up for display. |
| 484 { | 492 { |
| 485 SCOPED_TRACE("Waiting for BUFFERING_HAVE_NOTHING"); | 493 SCOPED_TRACE("Waiting for BUFFERING_HAVE_NOTHING"); |
| 486 WaitableMessageLoopEvent event; | 494 WaitableMessageLoopEvent event; |
| 487 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_NOTHING)) | 495 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_NOTHING)) |
| 488 .WillOnce(RunClosure(event.GetClosure())); | 496 .WillOnce(RunClosure(event.GetClosure())); |
| 497 EXPECT_CALL(mock_cb_, Display(HasTimestamp(10))).Times(0); |
| 498 EXPECT_CALL(mock_cb_, Display(HasTimestamp(20))).Times(0); |
| 499 EXPECT_CALL(mock_cb_, Display(HasTimestamp(30))).Times(1); |
| 489 AdvanceTimeInMs(3000); // Must match kTimeToDeclareHaveNothing. | 500 AdvanceTimeInMs(3000); // Must match kTimeToDeclareHaveNothing. |
| 490 event.RunAndWait(); | 501 event.RunAndWait(); |
| 491 } | 502 } |
| 492 | 503 |
| 493 // Receiving end of stream should signal having enough. | 504 // Receiving end of stream should signal having enough. |
| 494 { | 505 { |
| 495 SCOPED_TRACE("Waiting for BUFFERING_HAVE_ENOUGH"); | 506 SCOPED_TRACE("Waiting for BUFFERING_HAVE_ENOUGH"); |
| 496 WaitableMessageLoopEvent event; | 507 WaitableMessageLoopEvent event; |
| 497 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)) | 508 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)) |
| 498 .WillOnce(RunClosure(event.GetClosure())); | 509 .WillOnce(RunClosure(event.GetClosure())); |
| 499 SatisfyPendingReadWithEndOfStream(); | 510 SatisfyPendingReadWithEndOfStream(); |
| 500 event.RunAndWait(); | 511 event.RunAndWait(); |
| 501 } | 512 } |
| 502 | 513 |
| 503 WaitForEnded(); | 514 WaitForEnded(); |
| 504 Destroy(); | 515 Destroy(); |
| 505 } | 516 } |
| 506 | 517 |
| 507 } // namespace media | 518 } // namespace media |
| OLD | NEW |