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

Side by Side Diff: content/renderer/media/video_track_recorder_unittest.cc

Issue 1892673002: VideoTrackRecorder: add support for more codecs on construction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: emircan@ nits Created 4 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 unified diff | Download patch
« no previous file with comments | « content/renderer/media/video_track_recorder.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/video_track_recorder.h" 5 #include "content/renderer/media/video_track_recorder.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 22 matching lines...) Expand all
33 using ::testing::SaveArg; 33 using ::testing::SaveArg;
34 using ::testing::TestWithParam; 34 using ::testing::TestWithParam;
35 using ::testing::ValuesIn; 35 using ::testing::ValuesIn;
36 36
37 namespace content { 37 namespace content {
38 38
39 ACTION_P(RunClosure, closure) { 39 ACTION_P(RunClosure, closure) {
40 closure.Run(); 40 closure.Run();
41 } 41 }
42 42
43 const bool kTrackRecorderTestUseVp9OrNot[] = {false, true}; 43 const VideoTrackRecorder::CodecId kTrackRecorderTestCodec[] = {
44 VideoTrackRecorder::CodecId::VP8, VideoTrackRecorder::CodecId::VP9};
44 45
45 class VideoTrackRecorderTest : public TestWithParam<bool> { 46 class VideoTrackRecorderTest
47 : public TestWithParam<VideoTrackRecorder::CodecId> {
46 public: 48 public:
47 VideoTrackRecorderTest() 49 VideoTrackRecorderTest()
48 : mock_source_(new MockMediaStreamVideoSource(false)) { 50 : mock_source_(new MockMediaStreamVideoSource(false)) {
49 const blink::WebString webkit_track_id(base::UTF8ToUTF16("dummy")); 51 const blink::WebString webkit_track_id(base::UTF8ToUTF16("dummy"));
50 blink_source_.initialize(webkit_track_id, 52 blink_source_.initialize(webkit_track_id,
51 blink::WebMediaStreamSource::TypeVideo, 53 blink::WebMediaStreamSource::TypeVideo,
52 webkit_track_id); 54 webkit_track_id);
53 blink_source_.setExtraData(mock_source_); 55 blink_source_.setExtraData(mock_source_);
54 blink_track_.initialize(blink_source_); 56 blink_track_.initialize(blink_source_);
55 57
56 blink::WebMediaConstraints constraints; 58 blink::WebMediaConstraints constraints;
57 constraints.initialize(); 59 constraints.initialize();
58 track_ = new MediaStreamVideoTrack(mock_source_, constraints, 60 track_ = new MediaStreamVideoTrack(mock_source_, constraints,
59 MediaStreamSource::ConstraintsCallback(), 61 MediaStreamSource::ConstraintsCallback(),
60 true /* enabled */); 62 true /* enabled */);
61 blink_track_.setExtraData(track_); 63 blink_track_.setExtraData(track_);
62 64
63 video_track_recorder_.reset(new VideoTrackRecorder( 65 video_track_recorder_.reset(new VideoTrackRecorder(
64 GetParam() /* use_vp9 */, blink_track_, 66 GetParam() /* codec */, blink_track_,
65 base::Bind(&VideoTrackRecorderTest::OnEncodedVideo, 67 base::Bind(&VideoTrackRecorderTest::OnEncodedVideo,
66 base::Unretained(this)), 68 base::Unretained(this)),
67 0 /* bits_per_second */)); 69 0 /* bits_per_second */));
68 // Paranoia checks. 70 // Paranoia checks.
69 EXPECT_EQ(blink_track_.source().getExtraData(), 71 EXPECT_EQ(blink_track_.source().getExtraData(),
70 blink_source_.getExtraData()); 72 blink_source_.getExtraData());
71 EXPECT_TRUE(message_loop_.IsCurrent()); 73 EXPECT_TRUE(message_loop_.IsCurrent());
72 } 74 }
73 75
74 ~VideoTrackRecorderTest() { 76 ~VideoTrackRecorderTest() {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 const size_t kEncodedSizeThreshold = 18; 168 const size_t kEncodedSizeThreshold = 18;
167 EXPECT_GE(first_frame_encoded_data.size(), kEncodedSizeThreshold); 169 EXPECT_GE(first_frame_encoded_data.size(), kEncodedSizeThreshold);
168 EXPECT_GE(second_frame_encoded_data.size(), kEncodedSizeThreshold); 170 EXPECT_GE(second_frame_encoded_data.size(), kEncodedSizeThreshold);
169 EXPECT_GE(third_frame_encoded_data.size(), kEncodedSizeThreshold); 171 EXPECT_GE(third_frame_encoded_data.size(), kEncodedSizeThreshold);
170 172
171 Mock::VerifyAndClearExpectations(this); 173 Mock::VerifyAndClearExpectations(this);
172 } 174 }
173 175
174 INSTANTIATE_TEST_CASE_P(, 176 INSTANTIATE_TEST_CASE_P(,
175 VideoTrackRecorderTest, 177 VideoTrackRecorderTest,
176 ValuesIn(kTrackRecorderTestUseVp9OrNot)); 178 ValuesIn(kTrackRecorderTestCodec));
177 179
178 } // namespace content 180 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/video_track_recorder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698