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 c1a029f236eb9d98a80a6886d2a8953005058b71..55fe53a749a437ef1c51c96c08f6fb2f067ece1f 100644 |
--- a/media/renderers/video_renderer_impl_unittest.cc |
+++ b/media/renderers/video_renderer_impl_unittest.cc |
@@ -54,6 +54,7 @@ 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_)); |
@@ -108,7 +109,6 @@ 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,9 +265,15 @@ class VideoRendererImplTest : public ::testing::Test { |
NiceMock<MockDemuxerStream> demuxer_stream_; |
// Use StrictMock<T> to catch missing/extra callbacks. |
- class MockCB { |
+ // 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 { |
public: |
- MOCK_METHOD1(Display, void(const scoped_refptr<VideoFrame>&)); |
+ MOCK_METHOD1(Start, void(VideoRendererSink::RenderCallback*)); |
+ MOCK_METHOD0(Stop, void()); |
+ MOCK_METHOD1(PaintFrameUsingOldRenderingPath, |
+ void(const scoped_refptr<VideoFrame>&)); |
MOCK_METHOD1(BufferingStateChange, void(BufferingState)); |
}; |
StrictMock<MockCB> mock_cb_; |
@@ -349,7 +355,7 @@ TEST_F(VideoRendererImplTest, Initialize) { |
TEST_F(VideoRendererImplTest, InitializeAndStartPlayingFrom) { |
Initialize(); |
QueueFrames("0 10 20 30"); |
- EXPECT_CALL(mock_cb_, Display(HasTimestamp(0))); |
+ EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); |
EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
StartPlayingFrom(0); |
Destroy(); |
@@ -363,7 +369,7 @@ TEST_F(VideoRendererImplTest, DestroyWhileInitializing) { |
TEST_F(VideoRendererImplTest, DestroyWhileFlushing) { |
Initialize(); |
QueueFrames("0 10 20 30"); |
- EXPECT_CALL(mock_cb_, Display(HasTimestamp(0))); |
+ EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); |
EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
StartPlayingFrom(0); |
EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_NOTHING)); |
@@ -374,7 +380,7 @@ TEST_F(VideoRendererImplTest, DestroyWhileFlushing) { |
TEST_F(VideoRendererImplTest, Play) { |
Initialize(); |
QueueFrames("0 10 20 30"); |
- EXPECT_CALL(mock_cb_, Display(HasTimestamp(0))); |
+ EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); |
EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
StartPlayingFrom(0); |
Destroy(); |
@@ -393,7 +399,7 @@ TEST_F(VideoRendererImplTest, FlushWithNothingBuffered) { |
TEST_F(VideoRendererImplTest, DecodeError_Playing) { |
Initialize(); |
QueueFrames("0 10 20 30"); |
- EXPECT_CALL(mock_cb_, Display(HasTimestamp(0))); |
+ EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); |
EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
StartPlayingFrom(0); |
@@ -414,7 +420,7 @@ TEST_F(VideoRendererImplTest, StartPlayingFrom_Exact) { |
Initialize(); |
QueueFrames("50 60 70 80 90"); |
- EXPECT_CALL(mock_cb_, Display(HasTimestamp(60))); |
+ EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(60))); |
EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
StartPlayingFrom(60); |
Destroy(); |
@@ -424,7 +430,7 @@ TEST_F(VideoRendererImplTest, StartPlayingFrom_RightBefore) { |
Initialize(); |
QueueFrames("50 60 70 80 90"); |
- EXPECT_CALL(mock_cb_, Display(HasTimestamp(50))); |
+ EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(50))); |
EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
StartPlayingFrom(59); |
Destroy(); |
@@ -434,7 +440,7 @@ TEST_F(VideoRendererImplTest, StartPlayingFrom_RightAfter) { |
Initialize(); |
QueueFrames("50 60 70 80 90"); |
- EXPECT_CALL(mock_cb_, Display(HasTimestamp(60))); |
+ EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(60))); |
EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
StartPlayingFrom(61); |
Destroy(); |
@@ -446,7 +452,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_, Display(HasTimestamp(0))); |
+ EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); |
EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)) |
.Times(AnyNumber()); |
EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_NOTHING)) |
@@ -457,7 +463,7 @@ TEST_F(VideoRendererImplTest, StartPlayingFrom_LowDelay) { |
SatisfyPendingRead(); |
WaitableMessageLoopEvent event; |
- EXPECT_CALL(mock_cb_, Display(HasTimestamp(10))) |
+ EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(10))) |
.WillOnce(RunClosure(event.GetClosure())); |
AdvanceTimeInMs(10); |
event.RunAndWait(); |
@@ -469,7 +475,7 @@ TEST_F(VideoRendererImplTest, StartPlayingFrom_LowDelay) { |
TEST_F(VideoRendererImplTest, DestroyDuringOutstandingRead) { |
Initialize(); |
QueueFrames("0 10 20 30"); |
- EXPECT_CALL(mock_cb_, Display(HasTimestamp(0))); |
+ EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); |
EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
StartPlayingFrom(0); |
@@ -490,7 +496,7 @@ TEST_F(VideoRendererImplTest, Underflow) { |
{ |
WaitableMessageLoopEvent event; |
- EXPECT_CALL(mock_cb_, Display(HasTimestamp(0))); |
+ EXPECT_CALL(mock_cb_, PaintFrameUsingOldRenderingPath(HasTimestamp(0))); |
EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)) |
.WillOnce(RunClosure(event.GetClosure())); |
StartPlayingFrom(0); |
@@ -509,9 +515,12 @@ TEST_F(VideoRendererImplTest, Underflow) { |
WaitableMessageLoopEvent event; |
EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_NOTHING)) |
.WillOnce(RunClosure(event.GetClosure())); |
- 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))).Times(1); |
+ 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))) |
+ .Times(1); |
AdvanceTimeInMs(3000); // Must match kTimeToDeclareHaveNothing. |
event.RunAndWait(); |
Mock::VerifyAndClearExpectations(&mock_cb_); |