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

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

Issue 1176613003: Fixing formats for Video Capture Device unittest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 | « no previous file | no next file » | 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 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698