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

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: 80-char line fix in test html. Created 3 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 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 EXPECT_EQ(720, supported_formats[3].frame_size.height()); 340 EXPECT_EQ(720, supported_formats[3].frame_size.height());
341 EXPECT_EQ(expected_format, supported_formats[3].pixel_format); 341 EXPECT_EQ(expected_format, supported_formats[3].pixel_format);
342 EXPECT_GE(supported_formats[3].frame_rate, 20.0); 342 EXPECT_GE(supported_formats[3].frame_rate, 20.0);
343 EXPECT_EQ(1920, supported_formats[4].frame_size.width()); 343 EXPECT_EQ(1920, supported_formats[4].frame_size.width());
344 EXPECT_EQ(1080, supported_formats[4].frame_size.height()); 344 EXPECT_EQ(1080, supported_formats[4].frame_size.height());
345 EXPECT_EQ(expected_format, supported_formats[4].pixel_format); 345 EXPECT_EQ(expected_format, supported_formats[4].pixel_format);
346 EXPECT_GE(supported_formats[4].frame_rate, 20.0); 346 EXPECT_GE(supported_formats[4].frame_rate, 20.0);
347 } 347 }
348 } 348 }
349 349
350 TEST_F(FakeVideoCaptureDeviceTest, GetCameraCalibration) {
351 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
352 switches::kUseFakeDeviceForMediaStream, "device-count=2");
353 std::unique_ptr<VideoCaptureDeviceDescriptors> descriptors(
354 EnumerateDevices());
355 ASSERT_EQ(2u, descriptors->size());
356 ASSERT_FALSE(descriptors->at(0).camera_calibration);
357 const VideoCaptureDeviceDescriptor& depth_device = descriptors->at(1);
358 EXPECT_EQ("/dev/video1", depth_device.device_id);
359 ASSERT_TRUE(depth_device.camera_calibration);
360 EXPECT_EQ(135.0, depth_device.camera_calibration->focal_length_x);
361 EXPECT_EQ(135.6, depth_device.camera_calibration->focal_length_y);
362 EXPECT_EQ(0.0, depth_device.camera_calibration->depth_near);
363 EXPECT_EQ(65.535, depth_device.camera_calibration->depth_far);
364 }
365
350 TEST_F(FakeVideoCaptureDeviceTest, GetAndSetCapabilities) { 366 TEST_F(FakeVideoCaptureDeviceTest, GetAndSetCapabilities) {
351 std::unique_ptr<VideoCaptureDevice> device(new FakeVideoCaptureDevice( 367 std::unique_ptr<VideoCaptureDevice> device(new FakeVideoCaptureDevice(
352 FakeVideoCaptureDevice::BufferOwnership::OWN_BUFFERS, 30.0)); 368 FakeVideoCaptureDevice::BufferOwnership::OWN_BUFFERS, 30.0));
353 ASSERT_TRUE(device); 369 ASSERT_TRUE(device);
354 370
355 VideoCaptureParams capture_params; 371 VideoCaptureParams capture_params;
356 capture_params.requested_format.frame_size.SetSize(640, 480); 372 capture_params.requested_format.frame_size.SetSize(640, 480);
357 capture_params.requested_format.frame_rate = 30.0; 373 capture_params.requested_format.frame_rate = 30.0;
358 device->AllocateAndStart(capture_params, std::move(client_)); 374 device->AllocateAndStart(capture_params, std::move(client_));
359 375
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 INSTANTIATE_TEST_CASE_P( 523 INSTANTIATE_TEST_CASE_P(
508 , 524 ,
509 FakeVideoCaptureDeviceCommandLineTest, 525 FakeVideoCaptureDeviceCommandLineTest,
510 Values(CommandLineTestData{"fps=-1", 5, 1u}, 526 Values(CommandLineTestData{"fps=-1", 5, 1u},
511 CommandLineTestData{"fps=29.97, device-count=1", 29.97f, 1u}, 527 CommandLineTestData{"fps=29.97, device-count=1", 29.97f, 1u},
512 CommandLineTestData{"fps=60, device-count=2", 60, 2u}, 528 CommandLineTestData{"fps=60, device-count=2", 60, 2u},
513 CommandLineTestData{"fps=1000, device-count=-1", 60, 1u}, 529 CommandLineTestData{"fps=1000, device-count=-1", 60, 1u},
514 CommandLineTestData{"device-count=2", 20, 2u}, 530 CommandLineTestData{"device-count=2", 20, 2u},
515 CommandLineTestData{"device-count=0", 20, 1u})); 531 CommandLineTestData{"device-count=0", 20, 1u}));
516 }; // namespace media 532 }; // namespace media
OLDNEW
« no previous file with comments | « media/capture/video/fake_video_capture_device_factory.cc ('k') | media/capture/video/video_capture_device_descriptor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698