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

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

Issue 2692883004: Allow FakeVideoCaptureDeviceFactory to specify number of supported formats per device. (Closed)
Patch Set: update comment 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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 image_capture_client_)); 488 image_capture_client_));
489 489
490 EXPECT_CALL(*image_capture_client_.get(), OnCorrectPhotoTaken()).Times(1); 490 EXPECT_CALL(*image_capture_client_.get(), OnCorrectPhotoTaken()).Times(1);
491 device->TakePhoto(std::move(scoped_callback)); 491 device->TakePhoto(std::move(scoped_callback));
492 492
493 run_loop_.reset(new base::RunLoop()); 493 run_loop_.reset(new base::RunLoop());
494 run_loop_->Run(); 494 run_loop_->Run();
495 device->StopAndDeAllocate(); 495 device->StopAndDeAllocate();
496 } 496 }
497 497
498 TEST_F(FakeVideoCaptureDeviceTest, ZeroFormats) {
499 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
500 switches::kUseFakeDeviceForMediaStream, "device-count=2,format-count=0");
501 std::unique_ptr<VideoCaptureDeviceDescriptors> descriptors(
502 EnumerateDevices());
503 ASSERT_EQ(2u, descriptors->size());
504 for (const auto& descriptor : *descriptors) {
505 VideoCaptureFormats supported_formats;
506 video_capture_device_factory_->GetSupportedFormats(descriptor,
507 &supported_formats);
508 EXPECT_EQ(0u, supported_formats.size());
509 }
510 }
511
498 TEST_P(FakeVideoCaptureDeviceCommandLineTest, FrameRateAndDeviceCount) { 512 TEST_P(FakeVideoCaptureDeviceCommandLineTest, FrameRateAndDeviceCount) {
499 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( 513 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
500 switches::kUseFakeDeviceForMediaStream, GetParam().argument); 514 switches::kUseFakeDeviceForMediaStream, GetParam().argument);
501 const std::unique_ptr<VideoCaptureDeviceDescriptors> descriptors( 515 const std::unique_ptr<VideoCaptureDeviceDescriptors> descriptors(
502 EnumerateDevices()); 516 EnumerateDevices());
503 EXPECT_EQ(descriptors->size(), GetParam().device_count); 517 EXPECT_EQ(descriptors->size(), GetParam().device_count);
504 ASSERT_FALSE(descriptors->empty()); 518 ASSERT_FALSE(descriptors->empty());
505 519
506 for (const auto& descriptors_iterator : *descriptors) { 520 for (const auto& descriptors_iterator : *descriptors) {
507 std::unique_ptr<VideoCaptureDevice> device = 521 std::unique_ptr<VideoCaptureDevice> device =
(...skipping 15 matching lines...) Expand all
523 INSTANTIATE_TEST_CASE_P( 537 INSTANTIATE_TEST_CASE_P(
524 , 538 ,
525 FakeVideoCaptureDeviceCommandLineTest, 539 FakeVideoCaptureDeviceCommandLineTest,
526 Values(CommandLineTestData{"fps=-1", 5, 1u}, 540 Values(CommandLineTestData{"fps=-1", 5, 1u},
527 CommandLineTestData{"fps=29.97, device-count=1", 29.97f, 1u}, 541 CommandLineTestData{"fps=29.97, device-count=1", 29.97f, 1u},
528 CommandLineTestData{"fps=60, device-count=2", 60, 2u}, 542 CommandLineTestData{"fps=60, device-count=2", 60, 2u},
529 CommandLineTestData{"fps=1000, device-count=-1", 60, 1u}, 543 CommandLineTestData{"fps=1000, device-count=-1", 60, 1u},
530 CommandLineTestData{"device-count=2", 20, 2u}, 544 CommandLineTestData{"device-count=2", 20, 2u},
531 CommandLineTestData{"device-count=0", 20, 1u})); 545 CommandLineTestData{"device-count=0", 20, 1u}));
532 }; // namespace media 546 }; // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698