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

Side by Side Diff: media/capture/video/fake_video_capture_device_unittest.cc

Issue 2606983002: Media Capture Depth Stream Extensions API: focal length and depth range. (Closed)
Patch Set: base::Optional and nits, thanks mcasas@. Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/capture/video/fake_video_capture_device.h" 5 #include "media/capture/video/fake_video_capture_device.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 EXPECT_EQ(720, supported_formats[3].frame_size.height()); 307 EXPECT_EQ(720, supported_formats[3].frame_size.height());
308 EXPECT_EQ(expected_format, supported_formats[3].pixel_format); 308 EXPECT_EQ(expected_format, supported_formats[3].pixel_format);
309 EXPECT_GE(supported_formats[3].frame_rate, 20.0); 309 EXPECT_GE(supported_formats[3].frame_rate, 20.0);
310 EXPECT_EQ(1920, supported_formats[4].frame_size.width()); 310 EXPECT_EQ(1920, supported_formats[4].frame_size.width());
311 EXPECT_EQ(1080, supported_formats[4].frame_size.height()); 311 EXPECT_EQ(1080, supported_formats[4].frame_size.height());
312 EXPECT_EQ(expected_format, supported_formats[4].pixel_format); 312 EXPECT_EQ(expected_format, supported_formats[4].pixel_format);
313 EXPECT_GE(supported_formats[4].frame_rate, 20.0); 313 EXPECT_GE(supported_formats[4].frame_rate, 20.0);
314 } 314 }
315 } 315 }
316 316
317 TEST_F(FakeVideoCaptureDeviceTest, GetCameraCalibration) {
318 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
319 switches::kUseFakeDeviceForMediaStream, "device-count=2");
320 std::unique_ptr<VideoCaptureDeviceDescriptors> descriptors(
321 EnumerateDevices());
322 ASSERT_EQ(2u, descriptors->size());
323 ASSERT_FALSE(descriptors->at(0).camera_calibration);
324 const VideoCaptureDeviceDescriptor& depth_device = descriptors->at(1);
325 EXPECT_EQ("/dev/video1", depth_device.device_id);
326 ASSERT_TRUE(depth_device.camera_calibration);
327 EXPECT_EQ(135.0, depth_device.camera_calibration->focal_length_x);
328 EXPECT_EQ(135.6, depth_device.camera_calibration->focal_length_y);
329 EXPECT_EQ(0.0, depth_device.camera_calibration->depth_near);
330 EXPECT_EQ(65.535, depth_device.camera_calibration->depth_far);
331 }
332
317 TEST_F(FakeVideoCaptureDeviceTest, GetAndSetCapabilities) { 333 TEST_F(FakeVideoCaptureDeviceTest, GetAndSetCapabilities) {
318 std::unique_ptr<VideoCaptureDevice> device(new FakeVideoCaptureDevice( 334 std::unique_ptr<VideoCaptureDevice> device(new FakeVideoCaptureDevice(
319 FakeVideoCaptureDevice::BufferOwnership::OWN_BUFFERS, 30.0)); 335 FakeVideoCaptureDevice::BufferOwnership::OWN_BUFFERS, 30.0));
320 ASSERT_TRUE(device); 336 ASSERT_TRUE(device);
321 337
322 VideoCaptureParams capture_params; 338 VideoCaptureParams capture_params;
323 capture_params.requested_format.frame_size.SetSize(640, 480); 339 capture_params.requested_format.frame_size.SetSize(640, 480);
324 capture_params.requested_format.frame_rate = 30.0; 340 capture_params.requested_format.frame_rate = 30.0;
325 device->AllocateAndStart(capture_params, std::move(client_)); 341 device->AllocateAndStart(capture_params, std::move(client_));
326 342
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 INSTANTIATE_TEST_CASE_P( 490 INSTANTIATE_TEST_CASE_P(
475 , 491 ,
476 FakeVideoCaptureDeviceCommandLineTest, 492 FakeVideoCaptureDeviceCommandLineTest,
477 Values(CommandLineTestData{"fps=-1", 5, 1u}, 493 Values(CommandLineTestData{"fps=-1", 5, 1u},
478 CommandLineTestData{"fps=29.97, device-count=1", 29.97f, 1u}, 494 CommandLineTestData{"fps=29.97, device-count=1", 29.97f, 1u},
479 CommandLineTestData{"fps=60, device-count=2", 60, 2u}, 495 CommandLineTestData{"fps=60, device-count=2", 60, 2u},
480 CommandLineTestData{"fps=1000, device-count=-1", 60, 1u}, 496 CommandLineTestData{"fps=1000, device-count=-1", 60, 1u},
481 CommandLineTestData{"device-count=2", 20, 2u}, 497 CommandLineTestData{"device-count=2", 20, 2u},
482 CommandLineTestData{"device-count=0", 20, 1u})); 498 CommandLineTestData{"device-count=0", 20, 1u}));
483 }; // namespace media 499 }; // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698