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

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

Issue 2712123003: Revert of Add MJPEG support to FakeVideoCaptureDevice (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/capture/video/fake_video_capture_device_factory.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/capture/video/fake_video_capture_device_unittest.cc
diff --git a/media/capture/video/fake_video_capture_device_unittest.cc b/media/capture/video/fake_video_capture_device_unittest.cc
index 661e0d194b66733f03f67e86f26e2d712104f25a..5a6974caa8c4d863d71119f426a5920221e60cc9 100644
--- a/media/capture/video/fake_video_capture_device_unittest.cc
+++ b/media/capture/video/fake_video_capture_device_unittest.cc
@@ -266,22 +266,13 @@
class FakeVideoCaptureDeviceTest
: public FakeVideoCaptureDeviceBase,
public ::testing::WithParamInterface<
- ::testing::tuple<FakeVideoCaptureDeviceMaker::PixelFormat,
+ ::testing::tuple<VideoPixelFormat,
FakeVideoCaptureDeviceMaker::DeliveryMode,
float>> {};
// Tests that a frame is delivered with the expected settings.
// Sweeps through a fixed set of requested/expected resolutions.
TEST_P(FakeVideoCaptureDeviceTest, CaptureUsing) {
- if (testing::get<1>(GetParam()) ==
- FakeVideoCaptureDeviceMaker::DeliveryMode::
- USE_CLIENT_PROVIDED_BUFFERS &&
- testing::get<0>(GetParam()) ==
- FakeVideoCaptureDeviceMaker::PixelFormat::MJPEG) {
- // Unsupported case
- return;
- }
-
const std::unique_ptr<VideoCaptureDeviceDescriptors> descriptors(
EnumerateDevices());
ASSERT_FALSE(descriptors->empty());
@@ -312,8 +303,7 @@
WaitForCapturedFrame();
EXPECT_EQ(resolution.second.width(), last_format().frame_size.width());
EXPECT_EQ(resolution.second.height(), last_format().frame_size.height());
- EXPECT_EQ(last_format().pixel_format,
- static_cast<VideoPixelFormat>(testing::get<0>(GetParam())));
+ EXPECT_EQ(last_format().pixel_format, testing::get<0>(GetParam()));
EXPECT_EQ(last_format().frame_rate, testing::get<2>(GetParam()));
device->StopAndDeAllocate();
}
@@ -322,9 +312,7 @@
INSTANTIATE_TEST_CASE_P(
,
FakeVideoCaptureDeviceTest,
- Combine(Values(FakeVideoCaptureDeviceMaker::PixelFormat::I420,
- FakeVideoCaptureDeviceMaker::PixelFormat::Y16,
- FakeVideoCaptureDeviceMaker::PixelFormat::MJPEG),
+ Combine(Values(PIXEL_FORMAT_I420, PIXEL_FORMAT_Y16, PIXEL_FORMAT_ARGB),
Values(FakeVideoCaptureDeviceMaker::DeliveryMode::
USE_DEVICE_INTERNAL_BUFFERS,
FakeVideoCaptureDeviceMaker::DeliveryMode::
@@ -333,22 +321,19 @@
TEST_F(FakeVideoCaptureDeviceTest, GetDeviceSupportedFormats) {
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
- switches::kUseFakeDeviceForMediaStream, "device-count=4");
+ switches::kUseFakeDeviceForMediaStream, "device-count=3");
std::unique_ptr<VideoCaptureDeviceDescriptors> descriptors(
EnumerateDevices());
- ASSERT_EQ(4u, descriptors->size());
- const VideoPixelFormat expected_format_by_device_index[] = {
- PIXEL_FORMAT_I420, PIXEL_FORMAT_Y16, PIXEL_FORMAT_MJPEG,
- PIXEL_FORMAT_I420};
-
- int device_index = 0;
+ ASSERT_EQ(3u, descriptors->size());
+
for (const auto& descriptors_iterator : *descriptors) {
VideoCaptureFormats supported_formats;
video_capture_device_factory_->GetSupportedFormats(descriptors_iterator,
&supported_formats);
ASSERT_EQ(5u, supported_formats.size());
+ const std::string device_id = descriptors_iterator.device_id;
VideoPixelFormat expected_format =
- expected_format_by_device_index[device_index];
+ (device_id == "/dev/video1") ? PIXEL_FORMAT_Y16 : PIXEL_FORMAT_I420;
EXPECT_EQ(96, supported_formats[0].frame_size.width());
EXPECT_EQ(96, supported_formats[0].frame_size.height());
EXPECT_EQ(expected_format, supported_formats[0].pixel_format);
@@ -369,7 +354,6 @@
EXPECT_EQ(1080, supported_formats[4].frame_size.height());
EXPECT_EQ(expected_format, supported_formats[4].pixel_format);
EXPECT_GE(supported_formats[4].frame_rate, 20.0);
- device_index++;
}
}
@@ -391,7 +375,7 @@
TEST_F(FakeVideoCaptureDeviceTest, GetAndSetCapabilities) {
auto device = FakeVideoCaptureDeviceMaker::MakeInstance(
- FakeVideoCaptureDeviceMaker::PixelFormat::I420,
+ PIXEL_FORMAT_I420,
FakeVideoCaptureDeviceMaker::DeliveryMode::USE_DEVICE_INTERNAL_BUFFERS,
30.0);
ASSERT_TRUE(device);
@@ -502,7 +486,7 @@
TEST_F(FakeVideoCaptureDeviceTest, TakePhoto) {
auto device = FakeVideoCaptureDeviceMaker::MakeInstance(
- FakeVideoCaptureDeviceMaker::PixelFormat::I420,
+ PIXEL_FORMAT_I420,
FakeVideoCaptureDeviceMaker::DeliveryMode::USE_DEVICE_INTERNAL_BUFFERS,
30.0);
ASSERT_TRUE(device);
@@ -594,17 +578,15 @@
60,
1u,
{PIXEL_FORMAT_I420}},
- CommandLineTestData{"device-count=4",
- 20,
- 4u,
-
- {PIXEL_FORMAT_I420, PIXEL_FORMAT_Y16,
- PIXEL_FORMAT_MJPEG, PIXEL_FORMAT_I420}},
- CommandLineTestData{"device-count=4,ownership=client",
- 20,
- 4u,
-
- {PIXEL_FORMAT_I420, PIXEL_FORMAT_Y16,
- PIXEL_FORMAT_MJPEG, PIXEL_FORMAT_I420}},
+ CommandLineTestData{
+ "device-count=3",
+ 20,
+ 3u,
+ {PIXEL_FORMAT_I420, PIXEL_FORMAT_Y16, PIXEL_FORMAT_I420}},
+ CommandLineTestData{
+ "device-count=3,ownership=client",
+ 20,
+ 3u,
+ {PIXEL_FORMAT_I420, PIXEL_FORMAT_Y16, PIXEL_FORMAT_I420}},
CommandLineTestData{"device-count=0", 20, 1u, {PIXEL_FORMAT_I420}}));
}; // namespace media
« no previous file with comments | « media/capture/video/fake_video_capture_device_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698