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

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

Issue 2000003002: Initialize based on frame sizes in VideoTrackRecorder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mrgpu2
Patch Set: Retake. Created 4 years, 6 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
Index: content/renderer/media/video_track_recorder_unittest.cc
diff --git a/content/renderer/media/video_track_recorder_unittest.cc b/content/renderer/media/video_track_recorder_unittest.cc
index a8390825af89b13c947bd4a49c53df5c1f54ab8c..f001ff851822843e57905f2aaa4dc5ad1a7be744 100644
--- a/content/renderer/media/video_track_recorder_unittest.cc
+++ b/content/renderer/media/video_track_recorder_unittest.cc
@@ -47,9 +47,13 @@ const VideoTrackRecorder::CodecId kTrackRecorderTestCodec[] = {
, VideoTrackRecorder::CodecId::H264
#endif
};
+const gfx::Size kTrackRecorderTestSize[] = {gfx::Size(160, 80),
+ gfx::Size(640, 480)};
+static const int kTrackRecorderTestSizeDiff = 20;
class VideoTrackRecorderTest
- : public TestWithParam<VideoTrackRecorder::CodecId> {
+ : public TestWithParam<
+ testing::tuple<VideoTrackRecorder::CodecId, gfx::Size>> {
public:
VideoTrackRecorderTest()
: mock_source_(new MockMediaStreamVideoSource(false)) {
@@ -68,7 +72,7 @@ class VideoTrackRecorderTest
blink_track_.setTrackData(track_);
video_track_recorder_.reset(new VideoTrackRecorder(
- GetParam() /* codec */, blink_track_,
+ testing::get<0>(GetParam()) /* codec */, blink_track_,
base::Bind(&VideoTrackRecorderTest::OnEncodedVideo,
base::Unretained(this)),
0 /* bits_per_second */));
@@ -105,7 +109,7 @@ class VideoTrackRecorderTest
// 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_;
+ base::MessageLoopForUI message_loop_;
const ChildProcess child_process_;
// All members are non-const due to the series of initialize() calls needed.
@@ -130,7 +134,7 @@ TEST_P(VideoTrackRecorderTest, ConstructAndDestruct) {}
// of larger size is sent and is expected to be encoded as a keyframe.
TEST_P(VideoTrackRecorderTest, VideoEncoding) {
// |frame_size| cannot be arbitrarily small, should be reasonable.
- const gfx::Size frame_size(160, 80);
+ const gfx::Size& frame_size = testing::get<1>(GetParam());
const scoped_refptr<VideoFrame> video_frame =
VideoFrame::CreateBlackFrame(frame_size);
const double kFrameRate = 60.0f;
@@ -144,6 +148,7 @@ TEST_P(VideoTrackRecorderTest, VideoEncoding) {
.Times(1)
.WillOnce(SaveArg<1>(&first_frame_encoded_data));
Encode(video_frame, timeticks_now);
+ message_loop_.RunUntilIdle();
// Send another Video Frame.
const base::TimeTicks timeticks_later = base::TimeTicks::Now();
@@ -154,7 +159,8 @@ TEST_P(VideoTrackRecorderTest, VideoEncoding) {
Encode(video_frame, timeticks_later);
// Send another Video Frame and expect only an DoOnEncodedVideo() callback.
- const gfx::Size frame_size2(180, 80);
+ const gfx::Size frame_size2(frame_size.width() + kTrackRecorderTestSizeDiff,
+ frame_size.height());
const scoped_refptr<VideoFrame> video_frame2 =
VideoFrame::CreateBlackFrame(frame_size2);
@@ -180,6 +186,7 @@ TEST_P(VideoTrackRecorderTest, VideoEncoding) {
INSTANTIATE_TEST_CASE_P(,
VideoTrackRecorderTest,
- ValuesIn(kTrackRecorderTestCodec));
+ ::testing::Combine(ValuesIn(kTrackRecorderTestCodec),
+ ValuesIn(kTrackRecorderTestSize)));
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698