Commit ef4d3874 authored by emircan's avatar emircan Committed by Commit bot

This CL fixes some issues that came up Video Capture Device unittest, where it...

This CL fixes some issues that came up Video Capture Device unittest, where it tries to capture format that are not supported by the device and makes size assumptions on it-device being daisy in this case-.

- We check the exact size if returned type is equal to the requested type PIXEL_FORMAT_I420.
- If it is some other format, excluding PIXEL_FORMAT_MJPEG, we make the assumption that it is at least 12 BPP.

BUG=482875

Review URL: https://codereview.chromium.org/1176613003

Cr-Commit-Position: refs/heads/master@{#333761}
parent 21270153
...@@ -322,8 +322,7 @@ TEST_P(VideoCaptureDeviceTest, CaptureWithSize) { ...@@ -322,8 +322,7 @@ TEST_P(VideoCaptureDeviceTest, CaptureWithSize) {
EXPECT_EQ(last_format().frame_size.width(), width); EXPECT_EQ(last_format().frame_size.width(), width);
EXPECT_EQ(last_format().frame_size.height(), height); EXPECT_EQ(last_format().frame_size.height(), height);
if (last_format().pixel_format != PIXEL_FORMAT_MJPEG) if (last_format().pixel_format != PIXEL_FORMAT_MJPEG)
EXPECT_LE(static_cast<size_t>(width * height * 3 / 2), EXPECT_EQ(size.GetArea(), last_format().frame_size.GetArea());
last_format().ImageAllocationSize());
device->StopAndDeAllocate(); device->StopAndDeAllocate();
} }
...@@ -345,6 +344,7 @@ TEST_F(VideoCaptureDeviceTest, MAYBE_AllocateBadSize) { ...@@ -345,6 +344,7 @@ TEST_F(VideoCaptureDeviceTest, MAYBE_AllocateBadSize) {
EXPECT_CALL(*client_, OnError(_)).Times(0); EXPECT_CALL(*client_, OnError(_)).Times(0);
const gfx::Size input_size(640, 480);
VideoCaptureParams capture_params; VideoCaptureParams capture_params;
capture_params.requested_format.frame_size.SetSize(637, 472); capture_params.requested_format.frame_size.SetSize(637, 472);
capture_params.requested_format.frame_rate = 35; capture_params.requested_format.frame_rate = 35;
...@@ -352,10 +352,10 @@ TEST_F(VideoCaptureDeviceTest, MAYBE_AllocateBadSize) { ...@@ -352,10 +352,10 @@ TEST_F(VideoCaptureDeviceTest, MAYBE_AllocateBadSize) {
device->AllocateAndStart(capture_params, client_.Pass()); device->AllocateAndStart(capture_params, client_.Pass());
WaitForCapturedFrame(); WaitForCapturedFrame();
device->StopAndDeAllocate(); device->StopAndDeAllocate();
EXPECT_EQ(last_format().frame_size.width(), 640); EXPECT_EQ(last_format().frame_size.width(), input_size.width());
EXPECT_EQ(last_format().frame_size.height(), 480); EXPECT_EQ(last_format().frame_size.height(), input_size.height());
EXPECT_EQ(static_cast<size_t>(640 * 480 * 3 / 2), if (last_format().pixel_format != PIXEL_FORMAT_MJPEG)
last_format().ImageAllocationSize()); EXPECT_EQ(input_size.GetArea(), last_format().frame_size.GetArea());
} }
// Cause hangs on Windows Debug. http://crbug.com/417824 // Cause hangs on Windows Debug. http://crbug.com/417824
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment