Chromium Code Reviews| 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)}; |
|
mcasas
2016/07/08 22:59:27
Link these two to |kVEAEncoderMinResolutionWidth|
emircan
2016/07/12 01:00:35
I put them in .h file in video_track_recorder name
|
| +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_; |
|
mcasas
2016/07/08 22:59:27
Restore const?
|
| 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 |