#include <memory>
#include <string>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/field_trial_params.h"
#include "base/run_loop.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h"
#include "chrome/browser/media/webrtc/media_stream_capture_indicator.h"
#include "chrome/browser/media/webrtc/media_stream_device_permissions.h"
#include "chrome/browser/media/webrtc/permission_bubble_media_access_handler.h"
#include "chrome/browser/media/webrtc/webrtc_browsertest_base.h"
#include "chrome/browser/permissions/permission_manager_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_enums.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/content_settings/browser/page_specific_content_settings.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/features.h"
#include "components/permissions/contexts/camera_pan_tilt_zoom_permission_context.h"
#include "components/permissions/permission_context_base.h"
#include "components/permissions/permission_manager.h"
#include "components/permissions/permission_request.h"
#include "components/permissions/permission_request_manager.h"
#include "components/permissions/permission_util.h"
#include "components/permissions/request_type.h"
#include "components/permissions/test/mock_permission_prompt_factory.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/mock_render_process_host.h"
#include "extensions/common/constants.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/mediastream/media_stream_request.h"
#include "third_party/blink/public/mojom/mediastream/media_stream.mojom.h"
PageSpecificContentSettings;
class MediaStreamDevicesControllerTest : public WebRtcTestBase { … };
class MediaStreamDevicesControllerPtzTest
: public MediaStreamDevicesControllerTest,
public ::testing::WithParamInterface<media::VideoCaptureControlSupport> { … };
IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, RequestAndAllowMic) { … }
IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, RequestAndAllowCam) { … }
IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, RequestAndBlockMic) { … }
IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, RequestAndBlockCam) { … }
IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest,
RequestAndAllowMicCam) { … }
IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest,
RequestAndBlockMicCam) { … }
IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest,
RequestMicCamBlockCam) { … }
IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest,
RequestMicCamBlockMic) { … }
IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest,
RequestCamDoesNotChangeMic) { … }
IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest,
DenyMicDoesNotChangeCam) { … }
struct ContentSettingsTestData { … };
IN_PROC_BROWSER_TEST_P(MediaStreamDevicesControllerPtzTest, ContentSettings) { … }
INSTANTIATE_TEST_SUITE_P(…);
IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest,
WebUIRequestAndAllowCam) { … }
IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest,
ExtensionRequestMicCam) { … }
IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest,
PepperRequestInsecure) { … }
IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, WebContentsDestroyed) { … }
IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest,
WebContentsDestroyedDuringRequest) { … }
IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest,
RequestAndKillSwitchMicCam) { … }
IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest,
RequestCamAndMicBlockedByPermissionsPolicy) { … }
IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest,
RequestCamBlockedByPermissionsPolicy) { … }
IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest,
PepperAudioRequestNoCamera) { … }
IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest,
PepperVideoRequestNoMic) { … }