Index: content/renderer/media/webrtc/webrtc_video_capturer_adapter_unittest.cc |
diff --git a/content/renderer/media/webrtc/webrtc_video_capturer_adapter_unittest.cc b/content/renderer/media/webrtc/webrtc_video_capturer_adapter_unittest.cc |
index bd817abaaa863bf4091f22b57a3c0bd46c070a46..250124d0b8238cfe756087ddd457625b26edaead 100644 |
--- a/content/renderer/media/webrtc/webrtc_video_capturer_adapter_unittest.cc |
+++ b/content/renderer/media/webrtc/webrtc_video_capturer_adapter_unittest.cc |
@@ -25,22 +25,23 @@ class WebRtcVideoCapturerAdapterTest |
void TestSourceCropFrame(int capture_width, |
int capture_height, |
- int expected_width, |
- int expected_height) { |
- const int visible_width = std::min(capture_width, expected_width); |
- const int horiz_crop = ((capture_width - visible_width) / 2); |
- const int visible_height = std::min(capture_height, expected_height); |
- const int vert_crop = ((expected_height - visible_height) / 2); |
+ int cropped_width, |
+ int cropped_height, |
+ int natural_width, |
+ int natural_height) { |
+ const int horiz_crop = ((capture_width - cropped_width) / 2); |
+ const int vert_crop = ((capture_height - cropped_height) / 2); |
gfx::Size coded_size(capture_width, capture_height); |
- gfx::Rect view_rect(horiz_crop, vert_crop, visible_width, visible_height); |
+ gfx::Size natural_size(natural_width, natural_height); |
+ gfx::Rect view_rect(horiz_crop, vert_crop, cropped_width, cropped_height); |
scoped_refptr<media::VideoFrame> frame = |
media::VideoFrame::CreateFrame(media::VideoFrame::I420, |
- coded_size, view_rect, coded_size, |
+ coded_size, view_rect, natural_size, |
base::TimeDelta()); |
adapter_.OnFrameCaptured(frame); |
- EXPECT_EQ(expected_width, output_frame_width_); |
- EXPECT_EQ(expected_height, output_frame_height_); |
+ EXPECT_EQ(natural_width, output_frame_width_); |
+ EXPECT_EQ(natural_height, output_frame_height_); |
} |
protected: |
void OnFrameCaptured(cricket::VideoCapturer* capturer, |
@@ -56,11 +57,15 @@ class WebRtcVideoCapturerAdapterTest |
}; |
TEST_F(WebRtcVideoCapturerAdapterTest, CropFrameTo640360) { |
- TestSourceCropFrame(640, 480, 640, 360); |
+ TestSourceCropFrame(640, 480, 640, 360, 640, 360); |
} |
-TEST_F(WebRtcVideoCapturerAdapterTest, CropFrameTo732489) { |
- TestSourceCropFrame(1280, 720, 731, 489); |
+TEST_F(WebRtcVideoCapturerAdapterTest, CropFrameTo320320) { |
+ TestSourceCropFrame(640, 480, 480, 480, 320, 320); |
+} |
+ |
+TEST_F(WebRtcVideoCapturerAdapterTest, Scale720To640360) { |
+ TestSourceCropFrame(1280, 720, 1280, 720, 640, 360); |
} |
} // namespace content |