Index: media/video/capture/video_capture_device_unittest.cc |
diff --git a/media/video/capture/video_capture_device_unittest.cc b/media/video/capture/video_capture_device_unittest.cc |
index 3ae4ef5c07d9e9bdaf2eb9e006e98a8ac5e5b9b3..7d432c4d1a3920d2853cfd840e5919192c87a1c4 100644 |
--- a/media/video/capture/video_capture_device_unittest.cc |
+++ b/media/video/capture/video_capture_device_unittest.cc |
@@ -321,9 +321,13 @@ TEST_P(VideoCaptureDeviceTest, CaptureWithSize) { |
WaitForCapturedFrame(); |
EXPECT_EQ(last_format().frame_size.width(), width); |
EXPECT_EQ(last_format().frame_size.height(), height); |
- if (last_format().pixel_format != PIXEL_FORMAT_MJPEG) |
+ if (last_format().pixel_format == PIXEL_FORMAT_I420) { |
+ EXPECT_EQ(static_cast<size_t>(width * height * 3 / 2), |
mcasas
2015/06/10 00:48:04
What about counting pixels instead of bytes?
if (
emircan
2015/06/10 01:19:59
Done.
|
+ last_format().ImageAllocationSize()); |
+ } else if ((last_format().pixel_format != PIXEL_FORMAT_MJPEG)) { |
EXPECT_LE(static_cast<size_t>(width * height * 3 / 2), |
last_format().ImageAllocationSize()); |
+ } |
device->StopAndDeAllocate(); |
} |
@@ -345,6 +349,9 @@ TEST_F(VideoCaptureDeviceTest, MAYBE_AllocateBadSize) { |
EXPECT_CALL(*client_, OnError(_)).Times(0); |
+ const int width = 640; |
+ const int height = 480; |
+ |
VideoCaptureParams capture_params; |
capture_params.requested_format.frame_size.SetSize(637, 472); |
capture_params.requested_format.frame_rate = 35; |
@@ -352,10 +359,15 @@ TEST_F(VideoCaptureDeviceTest, MAYBE_AllocateBadSize) { |
device->AllocateAndStart(capture_params, client_.Pass()); |
WaitForCapturedFrame(); |
device->StopAndDeAllocate(); |
- EXPECT_EQ(last_format().frame_size.width(), 640); |
- EXPECT_EQ(last_format().frame_size.height(), 480); |
- EXPECT_EQ(static_cast<size_t>(640 * 480 * 3 / 2), |
- last_format().ImageAllocationSize()); |
+ EXPECT_EQ(last_format().frame_size.width(), width); |
+ EXPECT_EQ(last_format().frame_size.height(), height); |
+ if (last_format().pixel_format == PIXEL_FORMAT_I420) { |
mcasas
2015/06/10 00:48:04
Idem.
|
+ EXPECT_EQ(static_cast<size_t>(width * height * 3 / 2), |
+ last_format().ImageAllocationSize()); |
+ } else if ((last_format().pixel_format != PIXEL_FORMAT_MJPEG)) { |
+ EXPECT_LE(static_cast<size_t>(width * height * 3 / 2), |
+ last_format().ImageAllocationSize()); |
+ } |
} |
// Cause hangs on Windows Debug. http://crbug.com/417824 |