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

Unified Diff: media/video/capture/video_capture_device_unittest.cc

Issue 897483002: Refactored pixel format resize operations in media/video/capture into a function called VideoCaptu… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added checks for unsupported pixel formats. Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/video/capture/file_video_capture_device.cc ('k') | media/video/capture/video_capture_types.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b2711ee1c74211b891e1c6d97c9dc23aa957ea44..153c2626ca2cdf5355ec3f9b11dc550ed867b742 100644
--- a/media/video/capture/video_capture_device_unittest.cc
+++ b/media/video/capture/video_capture_device_unittest.cc
@@ -269,6 +269,8 @@ TEST_F(VideoCaptureDeviceTest, CaptureVGA) {
WaitForCapturedFrame();
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());
device->StopAndDeAllocate();
}
@@ -293,6 +295,10 @@ TEST_F(VideoCaptureDeviceTest, Capture720p) {
device->AllocateAndStart(capture_params, client_.Pass());
// Get captured video frames.
WaitForCapturedFrame();
+ EXPECT_EQ(last_format().frame_size.width(), 1280);
+ EXPECT_EQ(last_format().frame_size.height(), 720);
+ EXPECT_EQ(static_cast<size_t>(1280 * 720 * 3 / 2),
+ last_format().ImageAllocationSize());
device->StopAndDeAllocate();
}
@@ -318,6 +324,8 @@ TEST_F(VideoCaptureDeviceTest, MAYBE_AllocateBadSize) {
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());
}
// Cause hangs on Windows Debug. http://crbug.com/417824
@@ -422,6 +430,8 @@ TEST_F(VideoCaptureDeviceTest, MAYBE_CaptureMjpeg) {
// Verify we get MJPEG from the device. Not all devices can capture 1280x720
// @ 30 fps, so we don't care about the exact resolution we get.
EXPECT_EQ(last_format().pixel_format, PIXEL_FORMAT_MJPEG);
+ EXPECT_GE(static_cast<size_t>(1280 * 720),
+ last_format().ImageAllocationSize());
device->StopAndDeAllocate();
}
« no previous file with comments | « media/video/capture/file_video_capture_device.cc ('k') | media/video/capture/video_capture_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698