Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2137)

Unified Diff: content/renderer/media_recorder/video_track_recorder_unittest.cc

Issue 2805353002: Merge 58: Handle HW encoder errors in VideoTrackRecorder (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/media_recorder/video_track_recorder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 093d2cf0045407de5bbfe84b3f4aacc756852aa4..1f901a6ca8c49845a5e8831c70bd5e55fb25f7ad 100644
--- a/content/renderer/media_recorder/video_track_recorder_unittest.cc
+++ b/content/renderer/media_recorder/video_track_recorder_unittest.cc
@@ -112,6 +112,12 @@ class VideoTrackRecorderTest
video_track_recorder_->OnVideoFrameForTesting(frame, capture_time);
}
+ void OnError() { video_track_recorder_->OnError(); }
+
+ 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_;
@@ -211,6 +217,31 @@ TEST_P(VideoTrackRecorderTest, EncodeFrameWithPaddedCodedSize) {
Mock::VerifyAndClearExpectations(this);
}
+// Inserts an OnError() call between sent frames.
+TEST_P(VideoTrackRecorderTest, HandlesOnError) {
+ 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),
« no previous file with comments | « content/renderer/media_recorder/video_track_recorder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698