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 79fca03a1793bcfb4d0fbbccda69004b8ccc6f9d..77325ea41db354584032e8324c040e2f7cb1bb18 100644 |
--- a/media/renderers/video_renderer_impl_unittest.cc |
+++ b/media/renderers/video_renderer_impl_unittest.cc |
@@ -216,8 +216,8 @@ class VideoRendererImplTest : public testing::Test { |
event.RunAndWait(); |
} |
- void WaitForPendingRead() { |
- SCOPED_TRACE("WaitForPendingRead()"); |
+ void WaitForPendingDecode() { |
+ SCOPED_TRACE("WaitForPendingDecode()"); |
if (!decode_cb_.is_null()) |
return; |
@@ -231,7 +231,7 @@ class VideoRendererImplTest : public testing::Test { |
DCHECK(wait_for_pending_decode_cb_.is_null()); |
} |
- void SatisfyPendingRead() { |
+ void SatisfyPendingDecode() { |
CHECK(!decode_cb_.is_null()); |
CHECK(!decode_results_.empty()); |
@@ -245,7 +245,7 @@ class VideoRendererImplTest : public testing::Test { |
decode_results_.pop_front(); |
} |
- void SatisfyPendingReadWithEndOfStream() { |
+ void SatisfyPendingDecodeWithEndOfStream() { |
DCHECK(!decode_cb_.is_null()); |
// Return EOS buffer to trigger EOS frame. |
@@ -258,7 +258,7 @@ class VideoRendererImplTest : public testing::Test { |
FROM_HERE, |
base::Bind(base::ResetAndReturn(&decode_cb_), DecodeStatus::OK)); |
- WaitForPendingRead(); |
+ WaitForPendingDecode(); |
message_loop_.PostTask( |
FROM_HERE, |
@@ -353,7 +353,7 @@ class VideoRendererImplTest : public testing::Test { |
EXPECT_CALL(mock_cb_, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH)) |
.WillOnce(RunClosure(event.GetClosure())); |
EXPECT_CALL(mock_cb_, OnEnded()); |
- SatisfyPendingReadWithEndOfStream(); |
+ SatisfyPendingDecodeWithEndOfStream(); |
event.RunAndWait(); |
} |
@@ -414,7 +414,7 @@ class VideoRendererImplTest : public testing::Test { |
QueueFrames("80 100 120 140 160"); |
else |
QueueFrames("40 60 80 90"); |
- SatisfyPendingRead(); |
+ SatisfyPendingDecode(); |
event.RunAndWait(); |
} |
@@ -449,14 +449,14 @@ class VideoRendererImplTest : public testing::Test { |
CHECK(decode_cb_.is_null()); |
decode_cb_ = decode_cb; |
- // Wake up WaitForPendingRead() if needed. |
+ // Wake up WaitForPendingDecode() if needed. |
if (!wait_for_pending_decode_cb_.is_null()) |
base::ResetAndReturn(&wait_for_pending_decode_cb_).Run(); |
if (decode_results_.empty()) |
return; |
- SatisfyPendingRead(); |
+ SatisfyPendingDecode(); |
} |
void FlushRequested(const base::Closure& callback) { |
@@ -464,7 +464,7 @@ class VideoRendererImplTest : public testing::Test { |
decode_results_.clear(); |
if (!decode_cb_.is_null()) { |
QueueFrames("abort"); |
- SatisfyPendingRead(); |
+ SatisfyPendingDecode(); |
} |
message_loop_.PostTask(FROM_HERE, callback); |
@@ -479,7 +479,7 @@ class VideoRendererImplTest : public testing::Test { |
VideoDecoder::DecodeCB decode_cb_; |
base::TimeDelta next_frame_timestamp_; |
- // Run during DecodeRequested() to unblock WaitForPendingRead(). |
+ // Run during DecodeRequested() to unblock WaitForPendingDecode(). |
base::Closure wait_for_pending_decode_cb_; |
std::deque<std::pair<DecodeStatus, scoped_refptr<VideoFrame>>> |
@@ -517,14 +517,14 @@ TEST_F(VideoRendererImplTest, InitializeAndStartPlayingFrom) { |
TEST_F(VideoRendererImplTest, InitializeAndEndOfStream) { |
Initialize(); |
StartPlayingFrom(0); |
- WaitForPendingRead(); |
+ WaitForPendingDecode(); |
{ |
SCOPED_TRACE("Waiting for BUFFERING_HAVE_ENOUGH"); |
WaitableMessageLoopEvent event; |
EXPECT_CALL(mock_cb_, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH)) |
.WillOnce(RunClosure(event.GetClosure())); |
EXPECT_CALL(mock_cb_, OnEnded()); |
- SatisfyPendingReadWithEndOfStream(); |
+ SatisfyPendingDecodeWithEndOfStream(); |
event.RunAndWait(); |
} |
// Firing a time state changed to true should be ignored... |
@@ -585,6 +585,10 @@ static void VideoRendererImplTest_FlushDoneCB(VideoRendererImplTest* test, |
TEST_F(VideoRendererImplTest, FlushCallbackNoLock) { |
Initialize(); |
+ EXPECT_CALL(mock_cb_, FrameReceived(HasTimestamp(0))); |
+ EXPECT_CALL(mock_cb_, OnStatisticsUpdate(_)).Times(AnyNumber()); |
+ EXPECT_CALL(mock_cb_, OnVideoNaturalSizeChange(_)).Times(1); |
+ EXPECT_CALL(mock_cb_, OnVideoOpacityChange(_)).Times(1); |
StartPlayingFrom(0); |
WaitableMessageLoopEvent event; |
renderer_->Flush( |
@@ -615,7 +619,7 @@ TEST_F(VideoRendererImplTest, DecodeError_Playing) { |
AdvanceTimeInMs(10); |
QueueFrames("error"); |
- SatisfyPendingRead(); |
+ SatisfyPendingDecode(); |
WaitForError(PIPELINE_ERROR_DECODE); |
Destroy(); |
} |
@@ -685,7 +689,7 @@ TEST_F(VideoRendererImplTest, StartPlayingFrom_LowDelay) { |
StartPlayingFrom(10); |
QueueFrames("20"); |
- SatisfyPendingRead(); |
+ SatisfyPendingDecode(); |
renderer_->OnTimeStateChanged(true); |
time_source_.StartTicking(); |
@@ -765,7 +769,7 @@ TEST_F(VideoRendererImplTest, RenderingStopsAfterFirstFrame) { |
StartPlayingFrom(0); |
EXPECT_TRUE(IsReadPending()); |
- SatisfyPendingReadWithEndOfStream(); |
+ SatisfyPendingDecodeWithEndOfStream(); |
event.RunAndWait(); |
} |
@@ -794,7 +798,7 @@ TEST_F(VideoRendererImplTest, RenderingStopsAfterOneFrameWithEOS) { |
renderer_->OnTimeStateChanged(true); |
EXPECT_TRUE(IsReadPending()); |
- SatisfyPendingReadWithEndOfStream(); |
+ SatisfyPendingDecodeWithEndOfStream(); |
WaitForEnded(); |
renderer_->OnTimeStateChanged(false); |
@@ -828,7 +832,7 @@ TEST_F(VideoRendererImplTest, RenderingStartedThenStopped) { |
// Consider the case that rendering is faster than we setup the test event. |
// In that case, when we run out of the frames, BUFFERING_HAVE_NOTHING will |
- // be called. And then during SatisfyPendingReadWithEndOfStream, |
+ // be called. And then during SatisfyPendingDecodeWithEndOfStream, |
// BUFFER_HAVE_ENOUGH will be called again. |
EXPECT_CALL(mock_cb_, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH)) |
.Times(testing::AtMost(1)); |
@@ -845,8 +849,8 @@ TEST_F(VideoRendererImplTest, RenderingStartedThenStopped) { |
null_video_sink_->set_background_render(true); |
AdvanceTimeInMs(91); |
EXPECT_CALL(mock_cb_, FrameReceived(HasTimestamp(90))); |
- WaitForPendingRead(); |
- SatisfyPendingReadWithEndOfStream(); |
+ WaitForPendingDecode(); |
+ SatisfyPendingDecodeWithEndOfStream(); |
// If this wasn't background rendering mode, this would result in two frames |
// being dropped, but since we set background render to true, none should be |
@@ -888,7 +892,7 @@ TEST_F(VideoRendererImplTest, UnderflowEvictionBeforeEOS) { |
event.RunAndWait(); |
} |
- WaitForPendingRead(); |
+ WaitForPendingDecode(); |
// Jump time far enough forward that no frames are valid. |
renderer_->OnTimeStateChanged(false); |
@@ -896,7 +900,7 @@ TEST_F(VideoRendererImplTest, UnderflowEvictionBeforeEOS) { |
time_source_.StopTicking(); |
// Providing the end of stream packet should remove all frames and exit. |
- SatisfyPendingReadWithEndOfStream(); |
+ SatisfyPendingDecodeWithEndOfStream(); |
EXPECT_CALL(mock_cb_, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
WaitForEnded(); |
Destroy(); |
@@ -926,8 +930,8 @@ TEST_F(VideoRendererImplTest, StartPlayingFromThenFlushThenEOS) { |
Flush(); |
StartPlayingFrom(200); |
- WaitForPendingRead(); |
- SatisfyPendingReadWithEndOfStream(); |
+ WaitForPendingDecode(); |
+ SatisfyPendingDecodeWithEndOfStream(); |
EXPECT_CALL(mock_cb_, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
WaitForEnded(); |
Destroy(); |