#include "base/command_line.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "content/browser/webrtc/webrtc_webcam_browsertest.h"
#include "content/public/common/content_features.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/public/test/test_utils.h"
#include "content/shell/browser/shell.h"
#include "media/base/media_switches.h"
#include "media/capture/video/fake_video_capture_device_factory.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
namespace content {
#define MAYBE_ManipulateFocusDistance …
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
#define MAYBE_ManipulatePan …
#define MAYBE_ManipulateZoom …
#else
#define MAYBE_ManipulatePan …
#define MAYBE_ManipulateZoom …
#endif
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
#define MAYBE_ManipulateExposureTime …
#else
#define MAYBE_ManipulateExposureTime …
#endif
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
#define MAYBE_GetPhotoSettings …
#define MAYBE_GetTrackSettings …
#else
#define MAYBE_GetPhotoSettings …
#define MAYBE_GetTrackSettings …
#endif
#define MAYBE_GrabFrame …
namespace {
static const char kImageCaptureHtmlFile[] = …;
enum class TargetCamera { … };
enum class TargetVideoCaptureImplementation { … };
const TargetVideoCaptureImplementation
kTargetVideoCaptureImplementationsForFakeDevice[] = …;
}
class WebRtcImageCaptureBrowserTestBase
: public UsingRealWebcam_WebRtcWebcamBrowserTest { … };
class WebRtcImageCaptureSucceedsBrowserTest
: public WebRtcImageCaptureBrowserTestBase,
public testing::WithParamInterface<
std::tuple<TargetCamera,
TargetVideoCaptureImplementation>> { … };
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
#define MAYBE_GetPhotoCapabilities …
#else
#define MAYBE_GetPhotoCapabilities …
#endif
IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureSucceedsBrowserTest,
MAYBE_GetPhotoCapabilities) { … }
IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureSucceedsBrowserTest,
MAYBE_GetPhotoSettings) { … }
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
#define MAYBE_TakePhoto …
#else
#define MAYBE_TakePhoto …
#endif
IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureSucceedsBrowserTest, MAYBE_TakePhoto) { … }
IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureSucceedsBrowserTest, MAYBE_GrabFrame) { … }
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
#define MAYBE_GetTrackCapabilities …
#else
#define MAYBE_GetTrackCapabilities …
#endif
IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureSucceedsBrowserTest,
MAYBE_GetTrackCapabilities) { … }
IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureSucceedsBrowserTest,
MAYBE_GetTrackSettings) { … }
IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureSucceedsBrowserTest,
MAYBE_ManipulatePan) { … }
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
#define MAYBE_ManipulateTilt …
#else
#define MAYBE_ManipulateTilt …
#endif
IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureSucceedsBrowserTest,
MAYBE_ManipulateTilt) { … }
IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureSucceedsBrowserTest,
MAYBE_ManipulateZoom) { … }
IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureSucceedsBrowserTest,
MAYBE_ManipulateExposureTime) { … }
IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureSucceedsBrowserTest,
MAYBE_ManipulateFocusDistance) { … }
INSTANTIATE_TEST_SUITE_P(…);
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_WIN)
const TargetVideoCaptureImplementation
kTargetVideoCaptureImplementationsForRealWebcam[] = …;
INSTANTIATE_TEST_SUITE_P(…);
#endif
template <typename FakeDeviceConfigTraits>
class WebRtcImageCaptureCustomConfigFakeDeviceBrowserTest
: public WebRtcImageCaptureBrowserTestBase { … };
struct GetPhotoStateFailsConfigTraits { … };
WebRtcImageCaptureGetPhotoStateFailsBrowserTest;
IN_PROC_BROWSER_TEST_F(WebRtcImageCaptureGetPhotoStateFailsBrowserTest,
GetCapabilities) { … }
IN_PROC_BROWSER_TEST_F(WebRtcImageCaptureGetPhotoStateFailsBrowserTest,
TakePhoto) { … }
IN_PROC_BROWSER_TEST_F(WebRtcImageCaptureGetPhotoStateFailsBrowserTest,
MAYBE_GrabFrame) { … }
struct SetPhotoOptionsFailsConfigTraits { … };
WebRtcImageCaptureSetPhotoOptionsFailsBrowserTest;
IN_PROC_BROWSER_TEST_F(WebRtcImageCaptureSetPhotoOptionsFailsBrowserTest,
TakePhoto) { … }
IN_PROC_BROWSER_TEST_F(WebRtcImageCaptureSetPhotoOptionsFailsBrowserTest,
MAYBE_GrabFrame) { … }
struct TakePhotoFailsConfigTraits { … };
WebRtcImageCaptureTakePhotoFailsBrowserTest;
IN_PROC_BROWSER_TEST_F(WebRtcImageCaptureTakePhotoFailsBrowserTest, TakePhoto) { … }
IN_PROC_BROWSER_TEST_F(WebRtcImageCaptureTakePhotoFailsBrowserTest,
MAYBE_GrabFrame) { … }
}