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

Side by Side Diff: media/renderers/video_renderer_impl_unittest.cc

Issue 1005303004: media: VideoRenderImpl: display last available frame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use std:min(time before next frame, 10ms) Created 5 years, 9 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
« no previous file with comments | « media/renderers/video_renderer_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « media/renderers/video_renderer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698