Chromium Code Reviews| Index: media/filters/video_renderer_base_unittest.cc |
| diff --git a/media/filters/video_renderer_base_unittest.cc b/media/filters/video_renderer_base_unittest.cc |
| index b7be329bed8f7b8a9b2e52cf69e3e3073a44911e..64f838271b0a5028f779e06254c05169792d0ba5 100644 |
| --- a/media/filters/video_renderer_base_unittest.cc |
| +++ b/media/filters/video_renderer_base_unittest.cc |
| @@ -131,7 +131,7 @@ class VideoRendererBaseTest : public ::testing::Test { |
| VideoDecoder::ReadCB read_cb(queued_read_cb_); |
| queued_read_cb_.Reset(); |
| base::AutoUnlock u(lock_); |
| - read_cb.Run(VideoFrame::CreateEmptyFrame()); |
| + read_cb.Run(VideoFrame::CreateEmptyFrame(), VideoDecoder::kOk); |
| } |
| void StartSeeking(int64 timestamp) { |
| @@ -197,12 +197,24 @@ class VideoRendererBaseTest : public ::testing::Test { |
| } |
| if (timestamp == kEndOfStream) { |
| - read_cb.Run(VideoFrame::CreateEmptyFrame()); |
| + read_cb.Run(VideoFrame::CreateEmptyFrame(), VideoDecoder::kOk); |
| } else { |
| - read_cb.Run(CreateFrame(timestamp, kFrameDuration)); |
| + read_cb.Run(CreateFrame(timestamp, kFrameDuration), VideoDecoder::kOk); |
| } |
| } |
| + void DecoderError() { |
| + // Lock+swap to avoid re-entrancy issues. |
| + VideoDecoder::ReadCB read_cb; |
| + { |
| + base::AutoLock l(lock_); |
| + CHECK(!read_cb_.is_null()) << "Can't deliver a frame without a callback"; |
|
Ami GONE FROM CHROMIUM
2012/04/27 16:49:14
unnecessary - l.215 will crash anyway.
xhwang
2012/04/27 23:22:30
Done.
|
| + std::swap(read_cb, read_cb_); |
| + } |
| + |
| + read_cb.Run(NULL, VideoDecoder::kDecodeError); |
| + } |
| + |
| void AbortRead() { |
| // Lock+swap to avoid re-entrancy issues. |
| VideoDecoder::ReadCB read_cb; |
| @@ -212,7 +224,7 @@ class VideoRendererBaseTest : public ::testing::Test { |
| std::swap(read_cb, read_cb_); |
| } |
| - read_cb.Run(NULL); |
| + read_cb.Run(NULL, VideoDecoder::kOk); |
| } |
| void ExpectCurrentFrame(bool present) { |
| @@ -335,7 +347,7 @@ class VideoRendererBaseTest : public ::testing::Test { |
| // Abort pending read. |
| if (!read_cb.is_null()) |
| - read_cb.Run(NULL); |
| + read_cb.Run(NULL, VideoDecoder::kOk); |
| callback.Run(); |
| } |
| @@ -364,9 +376,10 @@ class VideoRendererBaseTest : public ::testing::Test { |
| // Unlock to deliver the frame to avoid re-entrancy issues. |
| base::AutoUnlock ul(lock_); |
| if (timestamp == kEndOfStream) { |
| - read_cb.Run(VideoFrame::CreateEmptyFrame()); |
| + read_cb.Run(VideoFrame::CreateEmptyFrame(), VideoDecoder::kOk); |
| } else { |
| - read_cb.Run(CreateFrame(i * kFrameDuration, kFrameDuration)); |
| + read_cb.Run(CreateFrame(i * kFrameDuration, kFrameDuration), |
| + VideoDecoder::kOk); |
| i++; |
| } |
| } else { |
| @@ -444,6 +457,15 @@ TEST_F(VideoRendererBaseTest, EndOfStream) { |
| Shutdown(); |
| } |
| +TEST_F(VideoRendererBaseTest, DecoderError) { |
| + Initialize(); |
| + Play(); |
| + RenderFrame(kFrameDuration); |
| + EXPECT_CALL(host_, SetError(PIPELINE_ERROR_DECODE)); |
| + DecoderError(); |
| + Shutdown(); |
| +} |
| + |
| TEST_F(VideoRendererBaseTest, Seek_Exact) { |
| Initialize(); |
| Pause(); |