Index: media/renderers/video_renderer_impl_unittest.cc |
diff --git a/media/renderers/video_renderer_impl_unittest.cc b/media/renderers/video_renderer_impl_unittest.cc |
index 86f767f606b661dff9c1b7b3ee7875d2f9830b12..df5c9d3639ed7e554747554b05a6a83fa656c061 100644 |
--- a/media/renderers/video_renderer_impl_unittest.cc |
+++ b/media/renderers/video_renderer_impl_unittest.cc |
@@ -54,7 +54,6 @@ class VideoRendererImplTest : public ::testing::Test { |
decoders.push_back(decoder_); |
renderer_.reset(new VideoRendererImpl(message_loop_.message_loop_proxy(), |
- &mock_cb_, |
decoders.Pass(), true, |
new MediaLog())); |
renderer_->SetTickClockForTesting(scoped_ptr<base::TickClock>(tick_clock_)); |
@@ -109,6 +108,7 @@ class VideoRendererImplTest : public ::testing::Test { |
base::Unretained(this)), |
base::Bind(&StrictMock<MockCB>::BufferingStateChange, |
base::Unretained(&mock_cb_)), |
+ base::Bind(&StrictMock<MockCB>::Display, base::Unretained(&mock_cb_)), |
ended_event_.GetClosure(), error_event_.GetPipelineStatusCB(), |
base::Bind(&VideoRendererImplTest::GetWallClockTime, |
base::Unretained(this)), |
@@ -265,15 +265,9 @@ class VideoRendererImplTest : public ::testing::Test { |
NiceMock<MockDemuxerStream> demuxer_stream_; |
// Use StrictMock<T> to catch missing/extra callbacks. |
- // TODO(dalecurtis): Mocks won't be useful for the new rendering path, we'll |
- // need fake callback generators like we have for the audio path. |
- // http://crbug.com/473424 |
- class MockCB : public VideoRendererSink { |
+ class MockCB { |
public: |
- MOCK_METHOD1(Start, void(VideoRendererSink::RenderCallback*)); |
- MOCK_METHOD0(Stop, void()); |
- MOCK_METHOD1(PaintFrameUsingOldRenderingPath, |
- void(const scoped_refptr<VideoFrame>&)); |
+ MOCK_METHOD1(Display, void(const scoped_refptr<VideoFrame>&)); |
MOCK_METHOD1(BufferingStateChange, void(BufferingState)); |
}; |
StrictMock<MockCB> mock_cb_; |
@@ -355,7 +349,7 @@ TEST_F(VideoRendererImplTest, Initialize) { |
TEST_F(VideoRendererImplTest, InitializeAndStartPlayingFrom) { |
Initialize(); |
QueueFrames("0 10 20 30"); |
- EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); |
+ EXPECT_CALL(mock_cb_, Display(HasTimestamp(0))); |
EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
StartPlayingFrom(0); |
Destroy(); |
@@ -369,7 +363,7 @@ TEST_F(VideoRendererImplTest, DestroyWhileInitializing) { |
TEST_F(VideoRendererImplTest, DestroyWhileFlushing) { |
Initialize(); |
QueueFrames("0 10 20 30"); |
- EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); |
+ EXPECT_CALL(mock_cb_, Display(HasTimestamp(0))); |
EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
StartPlayingFrom(0); |
EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_NOTHING)); |
@@ -380,7 +374,7 @@ TEST_F(VideoRendererImplTest, DestroyWhileFlushing) { |
TEST_F(VideoRendererImplTest, Play) { |
Initialize(); |
QueueFrames("0 10 20 30"); |
- EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); |
+ EXPECT_CALL(mock_cb_, Display(HasTimestamp(0))); |
EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
StartPlayingFrom(0); |
Destroy(); |
@@ -399,7 +393,7 @@ TEST_F(VideoRendererImplTest, FlushWithNothingBuffered) { |
TEST_F(VideoRendererImplTest, DecodeError_Playing) { |
Initialize(); |
QueueFrames("0 10 20 30"); |
- EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); |
+ EXPECT_CALL(mock_cb_, Display(HasTimestamp(0))); |
EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
StartPlayingFrom(0); |
@@ -420,7 +414,7 @@ TEST_F(VideoRendererImplTest, StartPlayingFrom_Exact) { |
Initialize(); |
QueueFrames("50 60 70 80 90"); |
- EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(60))); |
+ EXPECT_CALL(mock_cb_, Display(HasTimestamp(60))); |
EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
StartPlayingFrom(60); |
Destroy(); |
@@ -430,7 +424,7 @@ TEST_F(VideoRendererImplTest, StartPlayingFrom_RightBefore) { |
Initialize(); |
QueueFrames("50 60 70 80 90"); |
- EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(50))); |
+ EXPECT_CALL(mock_cb_, Display(HasTimestamp(50))); |
EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
StartPlayingFrom(59); |
Destroy(); |
@@ -440,7 +434,7 @@ TEST_F(VideoRendererImplTest, StartPlayingFrom_RightAfter) { |
Initialize(); |
QueueFrames("50 60 70 80 90"); |
- EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(60))); |
+ EXPECT_CALL(mock_cb_, Display(HasTimestamp(60))); |
EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
StartPlayingFrom(61); |
Destroy(); |
@@ -452,7 +446,7 @@ TEST_F(VideoRendererImplTest, StartPlayingFrom_LowDelay) { |
QueueFrames("0"); |
// Expect some amount of have enough/nothing due to only requiring one frame. |
- EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); |
+ EXPECT_CALL(mock_cb_, Display(HasTimestamp(0))); |
EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)) |
.Times(AnyNumber()); |
EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_NOTHING)) |
@@ -463,7 +457,7 @@ TEST_F(VideoRendererImplTest, StartPlayingFrom_LowDelay) { |
SatisfyPendingRead(); |
WaitableMessageLoopEvent event; |
- EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(10))) |
+ EXPECT_CALL(mock_cb_, Display(HasTimestamp(10))) |
.WillOnce(RunClosure(event.GetClosure())); |
AdvanceTimeInMs(10); |
event.RunAndWait(); |
@@ -475,7 +469,7 @@ TEST_F(VideoRendererImplTest, StartPlayingFrom_LowDelay) { |
TEST_F(VideoRendererImplTest, DestroyDuringOutstandingRead) { |
Initialize(); |
QueueFrames("0 10 20 30"); |
- EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); |
+ EXPECT_CALL(mock_cb_, Display(HasTimestamp(0))); |
EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
StartPlayingFrom(0); |
@@ -496,7 +490,7 @@ TEST_F(VideoRendererImplTest, Underflow) { |
{ |
WaitableMessageLoopEvent event; |
- EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); |
+ EXPECT_CALL(mock_cb_, Display(HasTimestamp(0))); |
EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)) |
.WillOnce(RunClosure(event.GetClosure())); |
StartPlayingFrom(0); |
@@ -509,19 +503,16 @@ TEST_F(VideoRendererImplTest, Underflow) { |
{ |
SCOPED_TRACE("Waiting for frame drops"); |
WaitableMessageLoopEvent event; |
- EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(10))) |
- .Times(0); |
- EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(20))) |
- .Times(0); |
- EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(30))) |
+ EXPECT_CALL(mock_cb_, Display(HasTimestamp(10))).Times(0); |
+ EXPECT_CALL(mock_cb_, Display(HasTimestamp(20))).Times(0); |
+ EXPECT_CALL(mock_cb_, Display(HasTimestamp(30))) |
.WillOnce(RunClosure(event.GetClosure())); |
AdvanceTimeInMs(31); |
event.RunAndWait(); |
Mock::VerifyAndClearExpectations(&mock_cb_); |
} |
- // Advance time more. Now we should signal having nothing. And put |
- // the last frame up for display. |
+ // Advance time more, such that a new frame should have been displayed by now. |
{ |
SCOPED_TRACE("Waiting for BUFFERING_HAVE_NOTHING"); |
WaitableMessageLoopEvent event; |