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

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

Issue 1034233002: Move underflow threshold limits out of the video renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@frame_time
Patch Set: Wait for frame duration. Created 5 years, 8 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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 { 491 {
492 WaitableMessageLoopEvent event; 492 WaitableMessageLoopEvent event;
493 EXPECT_CALL(mock_cb_, Display(HasTimestamp(0))); 493 EXPECT_CALL(mock_cb_, Display(HasTimestamp(0)));
494 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)) 494 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH))
495 .WillOnce(RunClosure(event.GetClosure())); 495 .WillOnce(RunClosure(event.GetClosure()));
496 StartPlayingFrom(0); 496 StartPlayingFrom(0);
497 event.RunAndWait(); 497 event.RunAndWait();
498 Mock::VerifyAndClearExpectations(&mock_cb_); 498 Mock::VerifyAndClearExpectations(&mock_cb_);
499 } 499 }
500 500
501 // Advance time slightly. Frames should be dropped and we should NOT signal 501 // Advance time slightly, but enough to exceed the duration of the last frame.
502 // having nothing. 502 // Frames should be dropped and we should NOT signal having nothing.
503 AdvanceTimeInMs(100); 503 {
504 SCOPED_TRACE("Waiting for frame drops");
505 WaitableMessageLoopEvent event;
506 EXPECT_CALL(mock_cb_, Display(HasTimestamp(10))).Times(0);
507 EXPECT_CALL(mock_cb_, Display(HasTimestamp(20))).Times(0);
508 EXPECT_CALL(mock_cb_, Display(HasTimestamp(30)))
509 .WillOnce(RunClosure(event.GetClosure()));
510 AdvanceTimeInMs(31);
511 event.RunAndWait();
512 Mock::VerifyAndClearExpectations(&mock_cb_);
513 }
504 514
505 // Advance time more. Now we should signal having nothing. And put 515 // Advance time more, such that a new frame should have been displayed by now.
506 // the last frame up for display.
507 { 516 {
508 SCOPED_TRACE("Waiting for BUFFERING_HAVE_NOTHING"); 517 SCOPED_TRACE("Waiting for BUFFERING_HAVE_NOTHING");
509 WaitableMessageLoopEvent event; 518 WaitableMessageLoopEvent event;
510 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_NOTHING)) 519 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_NOTHING))
511 .WillOnce(RunClosure(event.GetClosure())); 520 .WillOnce(RunClosure(event.GetClosure()));
512 EXPECT_CALL(mock_cb_, Display(HasTimestamp(10))).Times(0); 521 AdvanceWallclockTimeInMs(9);
513 EXPECT_CALL(mock_cb_, Display(HasTimestamp(20))).Times(0);
514 EXPECT_CALL(mock_cb_, Display(HasTimestamp(30))).Times(1);
515 AdvanceTimeInMs(3000); // Must match kTimeToDeclareHaveNothing.
516 event.RunAndWait(); 522 event.RunAndWait();
517 Mock::VerifyAndClearExpectations(&mock_cb_); 523 Mock::VerifyAndClearExpectations(&mock_cb_);
518 } 524 }
519 525
520 // Receiving end of stream should signal having enough. 526 // Receiving end of stream should signal having enough.
521 { 527 {
522 SCOPED_TRACE("Waiting for BUFFERING_HAVE_ENOUGH"); 528 SCOPED_TRACE("Waiting for BUFFERING_HAVE_ENOUGH");
523 WaitableMessageLoopEvent event; 529 WaitableMessageLoopEvent event;
524 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)) 530 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH))
525 .WillOnce(RunClosure(event.GetClosure())); 531 .WillOnce(RunClosure(event.GetClosure()));
526 SatisfyPendingReadWithEndOfStream(); 532 SatisfyPendingReadWithEndOfStream();
527 event.RunAndWait(); 533 event.RunAndWait();
528 } 534 }
529 535
530 WaitForEnded(); 536 WaitForEnded();
531 Destroy(); 537 Destroy();
532 } 538 }
533 539
534 } // namespace media 540 } // 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