OLD | NEW |
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 23 matching lines...) Expand all Loading... |
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 VideoTrackRecorder::CodecId kTrackRecorderTestCodec[] = { | 43 const VideoTrackRecorder::CodecId kTrackRecorderTestCodec[] = { |
44 VideoTrackRecorder::CodecId::VP8, VideoTrackRecorder::CodecId::VP9}; | 44 VideoTrackRecorder::CodecId::VP8, |
| 45 VideoTrackRecorder::CodecId::VP9 |
| 46 #if BUILDFLAG(RTC_USE_H264) |
| 47 , VideoTrackRecorder::CodecId::H264 |
| 48 #endif |
| 49 }; |
45 | 50 |
46 class VideoTrackRecorderTest | 51 class VideoTrackRecorderTest |
47 : public TestWithParam<VideoTrackRecorder::CodecId> { | 52 : public TestWithParam<VideoTrackRecorder::CodecId> { |
48 public: | 53 public: |
49 VideoTrackRecorderTest() | 54 VideoTrackRecorderTest() |
50 : mock_source_(new MockMediaStreamVideoSource(false)) { | 55 : mock_source_(new MockMediaStreamVideoSource(false)) { |
51 const blink::WebString webkit_track_id(base::UTF8ToUTF16("dummy")); | 56 const blink::WebString webkit_track_id(base::UTF8ToUTF16("dummy")); |
52 blink_source_.initialize(webkit_track_id, | 57 blink_source_.initialize(webkit_track_id, |
53 blink::WebMediaStreamSource::TypeVideo, | 58 blink::WebMediaStreamSource::TypeVideo, |
54 webkit_track_id); | 59 webkit_track_id); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 163 |
159 base::StringPiece third_frame_encoded_data; | 164 base::StringPiece third_frame_encoded_data; |
160 EXPECT_CALL(*this, DoOnEncodedVideo(video_frame2, _, _, true)) | 165 EXPECT_CALL(*this, DoOnEncodedVideo(video_frame2, _, _, true)) |
161 .Times(1) | 166 .Times(1) |
162 .WillOnce(DoAll(SaveArg<1>(&third_frame_encoded_data), | 167 .WillOnce(DoAll(SaveArg<1>(&third_frame_encoded_data), |
163 RunClosure(quit_closure))); | 168 RunClosure(quit_closure))); |
164 Encode(video_frame2, base::TimeTicks::Now()); | 169 Encode(video_frame2, base::TimeTicks::Now()); |
165 | 170 |
166 run_loop.Run(); | 171 run_loop.Run(); |
167 | 172 |
168 const size_t kEncodedSizeThreshold = 18; | 173 const size_t kEncodedSizeThreshold = 14; |
169 EXPECT_GE(first_frame_encoded_data.size(), kEncodedSizeThreshold); | 174 EXPECT_GE(first_frame_encoded_data.size(), kEncodedSizeThreshold); |
170 EXPECT_GE(second_frame_encoded_data.size(), kEncodedSizeThreshold); | 175 EXPECT_GE(second_frame_encoded_data.size(), kEncodedSizeThreshold); |
171 EXPECT_GE(third_frame_encoded_data.size(), kEncodedSizeThreshold); | 176 EXPECT_GE(third_frame_encoded_data.size(), kEncodedSizeThreshold); |
172 | 177 |
173 Mock::VerifyAndClearExpectations(this); | 178 Mock::VerifyAndClearExpectations(this); |
174 } | 179 } |
175 | 180 |
176 INSTANTIATE_TEST_CASE_P(, | 181 INSTANTIATE_TEST_CASE_P(, |
177 VideoTrackRecorderTest, | 182 VideoTrackRecorderTest, |
178 ValuesIn(kTrackRecorderTestCodec)); | 183 ValuesIn(kTrackRecorderTestCodec)); |
179 | 184 |
180 } // namespace content | 185 } // namespace content |
OLD | NEW |