#include "content/browser/renderer_host/media/media_devices_dispatcher_host.h"
#include <stddef.h>
#include <memory>
#include <queue>
#include <utility>
#include <vector>
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/test_future.h"
#include "build/build_config.h"
#include "content/browser/media/media_devices_permission_checker.h"
#include "content/browser/renderer_host/media/fake_video_capture_provider.h"
#include "content/browser/renderer_host/media/in_process_video_capture_provider.h"
#include "content/browser/renderer_host/media/media_stream_manager.h"
#include "content/browser/renderer_host/media/media_stream_ui_proxy.h"
#include "content/browser/renderer_host/media/video_capture_manager.h"
#include "content/browser/renderer_host/media/video_capture_provider_switcher.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/common/content_client.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_browser_context.h"
#include "content/public/test/test_renderer_host.h"
#include "content/test/test_web_contents.h"
#include "media/audio/audio_device_description.h"
#include "media/audio/audio_system_impl.h"
#include "media/audio/mock_audio_manager.h"
#include "media/audio/test_audio_thread.h"
#include "media/base/media_switches.h"
#include "media/capture/video/fake_video_capture_device_factory.h"
#include "media/capture/video/video_capture_system_impl.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/media/capture_handle_config.mojom.h"
#include "url/origin.h"
MediaDeviceType;
_;
SaveArg;
InvokeWithoutArgs;
namespace content {
namespace {
const size_t kNumFakeVideoDevices = …;
const char kNormalVideoDeviceID[] = …;
const char kNoFormatsVideoDeviceID[] = …;
const char kZeroResolutionVideoDeviceID[] = …;
const char* const kDefaultVideoDeviceID = …;
const char kDefaultAudioDeviceID[] = …;
void PhysicalDevicesEnumerated(base::OnceClosure quit_closure,
MediaDeviceEnumeration* out,
const MediaDeviceEnumeration& enumeration) { … }
class MockMediaDevicesListener : public blink::mojom::MediaDevicesListener { … };
std::u16string MaxLengthCaptureHandle() { … }
class FakeContentBrowserClient : public ContentBrowserClient { … };
}
class MediaDevicesDispatcherHostTest
: public testing::TestWithParam<std::string> { … };
TEST_P(MediaDevicesDispatcherHostTest, EnumerateAudioInputDevices) { … }
TEST_P(MediaDevicesDispatcherHostTest, EnumerateVideoInputDevices) { … }
TEST_P(MediaDevicesDispatcherHostTest, EnumerateAudioOutputDevices) { … }
TEST_P(MediaDevicesDispatcherHostTest, EnumerateAllDevices) { … }
TEST_P(MediaDevicesDispatcherHostTest, EnumerateAudioInputDevicesNoAccess) { … }
TEST_P(MediaDevicesDispatcherHostTest, EnumerateVideoInputDevicesNoAccess) { … }
TEST_P(MediaDevicesDispatcherHostTest, EnumerateAudioOutputDevicesNoAccess) { … }
TEST_P(MediaDevicesDispatcherHostTest, EnumerateAllDevicesNoAccess) { … }
TEST_P(MediaDevicesDispatcherHostTest, SubscribeDeviceChange) { … }
TEST_P(MediaDevicesDispatcherHostTest, SubscribeDeviceChangeNoAccess) { … }
TEST_P(MediaDevicesDispatcherHostTest, GetVideoInputCapabilities) { … }
TEST_P(MediaDevicesDispatcherHostTest, GetAudioInputCapabilities) { … }
TEST_P(MediaDevicesDispatcherHostTest, GetAllVideoInputDeviceFormats) { … }
TEST_P(MediaDevicesDispatcherHostTest, GetAvailableVideoInputDeviceFormats) { … }
TEST_P(MediaDevicesDispatcherHostTest, SetCaptureHandleConfigWithNullptr) { … }
TEST_P(MediaDevicesDispatcherHostTest,
SetCaptureHandleConfigWithExcessivelLongHandle) { … }
TEST_P(MediaDevicesDispatcherHostTest,
SetCaptureHandleConfigWithAllPermittedAndSpecificallyPermitted) { … }
TEST_P(MediaDevicesDispatcherHostTest, SetCaptureHandleConfigWithBadOrigin) { … }
TEST_P(MediaDevicesDispatcherHostTest,
SetCaptureHandleConfigWithMaxHandleLengthAllowed) { … }
TEST_P(MediaDevicesDispatcherHostTest,
SetCaptureHandleConfigWithSpecificOriginsAllowed) { … }
TEST_P(MediaDevicesDispatcherHostTest,
SetCaptureHandleConfigWithAllOriginsAllowed) { … }
TEST_P(MediaDevicesDispatcherHostTest,
GetAvailableVideoInputDeviceFormatsUnfoundDevice) { … }
TEST_P(MediaDevicesDispatcherHostTest,
GetAllVideoInputDeviceFormatsUnfoundDevice) { … }
TEST_P(MediaDevicesDispatcherHostTest,
RegisterAndUnregisterWithMediaDevicesManager) { … }
INSTANTIATE_TEST_SUITE_P(…);
}