| Index: content/renderer/media_recorder/video_track_recorder_unittest.cc
|
| diff --git a/content/renderer/media_recorder/video_track_recorder_unittest.cc b/content/renderer/media_recorder/video_track_recorder_unittest.cc
|
| index 615dcad2d800935840fccb6764cd956200a16d13..3301ab61609273f0f4de4adacac6a9f6747e2615 100644
|
| --- a/content/renderer/media_recorder/video_track_recorder_unittest.cc
|
| +++ b/content/renderer/media_recorder/video_track_recorder_unittest.cc
|
| @@ -119,10 +119,16 @@ class VideoTrackRecorderTest
|
| video_track_recorder_->OnVideoFrameForTesting(frame, capture_time);
|
| }
|
|
|
| + void OnError() { video_track_recorder_->OnError(); }
|
| +
|
| bool CanEncodeAlphaChannel() {
|
| return video_track_recorder_->CanEncodeAlphaChannelForTesting();
|
| }
|
|
|
| + bool HasEncoderInstance() {
|
| + return video_track_recorder_->encoder_.get() != nullptr;
|
| + }
|
| +
|
| // A ChildProcess and a MessageLoopForUI are both needed to fool the Tracks
|
| // and Sources below into believing they are on the right threads.
|
| const base::MessageLoopForUI message_loop_;
|
| @@ -267,6 +273,33 @@ TEST_F(VideoTrackRecorderTest, ForceKeyframeOnAlphaSwitch) {
|
| Mock::VerifyAndClearExpectations(this);
|
| }
|
|
|
| +// Inserts an OnError() call between sent frames.
|
| +TEST_F(VideoTrackRecorderTest, HandlesOnError) {
|
| + InitializeRecorder(VideoTrackRecorder::CodecId::VP8);
|
| +
|
| + const gfx::Size& frame_size = kTrackRecorderTestSize[0];
|
| + const scoped_refptr<VideoFrame> video_frame =
|
| + VideoFrame::CreateBlackFrame(frame_size);
|
| +
|
| + InSequence s;
|
| + EXPECT_CALL(*this, DoOnEncodedVideo(_, _, _, _, true)).Times(1);
|
| + Encode(video_frame, base::TimeTicks::Now());
|
| +
|
| + EXPECT_TRUE(HasEncoderInstance());
|
| + OnError();
|
| + EXPECT_FALSE(HasEncoderInstance());
|
| +
|
| + base::RunLoop run_loop;
|
| + base::Closure quit_closure = run_loop.QuitClosure();
|
| + EXPECT_CALL(*this, DoOnEncodedVideo(_, _, _, _, true))
|
| + .Times(1)
|
| + .WillOnce(RunClosure(quit_closure));
|
| + Encode(video_frame, base::TimeTicks::Now());
|
| + run_loop.Run();
|
| +
|
| + Mock::VerifyAndClearExpectations(this);
|
| +}
|
| +
|
| INSTANTIATE_TEST_CASE_P(,
|
| VideoTrackRecorderTest,
|
| ::testing::Combine(ValuesIn(kTrackRecorderTestCodec),
|
|
|