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

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: Created 4 years, 5 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..6d6808c3c802660fe1baa833e300d6b851f05941 100644
--- a/content/renderer/media/video_track_recorder_unittest.cc
+++ b/content/renderer/media/video_track_recorder_unittest.cc
@@ -24,6 +24,8 @@
#include "third_party/WebKit/public/web/WebHeap.h"
using media::VideoFrame;
+using video_track_recorder::kVEAEncoderMinResolutionWidth;
+using video_track_recorder::kVEAEncoderMinResolutionHeight;
using ::testing::_;
using ::testing::DoAll;
@@ -47,9 +49,15 @@ const VideoTrackRecorder::CodecId kTrackRecorderTestCodec[] = {
, VideoTrackRecorder::CodecId::H264
#endif
};
+const gfx::Size kTrackRecorderTestSize[] = {
+ gfx::Size(kVEAEncoderMinResolutionWidth / 2,
+ kVEAEncoderMinResolutionHeight / 2),
+ gfx::Size(kVEAEncoderMinResolutionWidth, kVEAEncoderMinResolutionHeight)};
+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 +76,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 */));
@@ -130,7 +138,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;
@@ -154,7 +162,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 +189,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