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

Unified Diff: content/browser/renderer_host/media/media_devices_dispatcher_host_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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc
diff --git a/content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc b/content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc
index c999cc0f6415d4112bb9b6aee18375e07bfc0bd6..c94f7a3809284d89da7d8ee85ffbcdbcd866cd89 100644
--- a/content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc
+++ b/content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc
@@ -74,11 +74,14 @@ class MediaDevicesDispatcherHostTest : public testing::Test {
MediaDevicesDispatcherHostTest()
: thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP),
origin_(GURL("https://test.com")) {
- // Make sure we use fake devices to avoid long delays.
+ // Make sure we use fake devices to avoid long delays. Also, have the fake
+ // devices not report any formats in order to force fallback formats to be
+ // used.
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
switches::kUseFakeDeviceForMediaStream,
- base::StringPrintf("device-count=%zu, video-input-default-id=%s",
- kNumFakeVideoDevices, kDefaultVideoDeviceID));
+ base::StringPrintf(
+ "device-count=%zu, video-input-default-id=%s, format-count=0",
+ kNumFakeVideoDevices, kDefaultVideoDeviceID));
audio_manager_.reset(
new media::MockAudioManager(base::ThreadTaskRunnerHandle::Get()));
media_stream_manager_.reset(new MediaStreamManager(audio_manager_.get()));
@@ -124,6 +127,8 @@ class MediaDevicesDispatcherHostTest : public testing::Test {
EXPECT_EQ(kNumFakeVideoDevices, capabilities.size());
EXPECT_EQ(expected_first_device_id, capabilities[0]->device_id);
for (const auto& capability : capabilities) {
+ // Expect at least one format, even if the device is unable to report its
+ // supported formats.
EXPECT_GT(capability->formats.size(), 1u);
EXPECT_GT(capability->formats[0].frame_size.width(), 1);
EXPECT_GT(capability->formats[0].frame_size.height(), 1);

Powered by Google App Engine
This is Rietveld 408576698