#include <array>
#include "base/command_line.h"
#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/extensions/api/desktop_capture/desktop_capture_api.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/media/webrtc/fake_desktop_media_picker_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "extensions/common/switches.h"
#include "extensions/test/test_extension_dir.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_capture_types.h"
#include "ui/base/ozone_buildflags.h"
namespace extensions {
namespace {
DesktopMediaID;
WebContentsMediaCaptureId;
Combine;
Values;
class DesktopCaptureApiTest : public ExtensionApiTest { … };
}
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_OZONE_WAYLAND) || \
BUILDFLAG(IS_CHROMEOS_LACROS)
#define MAYBE_ChooseDesktopMedia …
#else
#define MAYBE_ChooseDesktopMedia …
#endif
IN_PROC_BROWSER_TEST_F(DesktopCaptureApiTest, MAYBE_ChooseDesktopMedia) { … }
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_OZONE_WAYLAND) || \
BUILDFLAG(IS_CHROMEOS_LACROS)
#define MAYBE_Delegation …
#else
#define MAYBE_Delegation …
#endif
IN_PROC_BROWSER_TEST_F(DesktopCaptureApiTest, MAYBE_Delegation) { … }
IN_PROC_BROWSER_TEST_F(DesktopCaptureApiTest, ServiceWorkerMustSpecifyTab) { … }
class DesktopCaptureApiMediaPickerOptionsBaseTest
: public DesktopCaptureApiTest { … };
void DesktopCaptureApiMediaPickerOptionsBaseTest::FromServiceWorker(
const std::string& options) { … }
class DesktopCaptureApiMediaPickerWithOptionsTest
: public DesktopCaptureApiMediaPickerOptionsBaseTest,
public testing::WithParamInterface<
std::tuple<std::string, std::string, std::string>> { … };
INSTANTIATE_TEST_SUITE_P(…);
IN_PROC_BROWSER_TEST_P(DesktopCaptureApiMediaPickerWithOptionsTest,
FromServiceWorker) { … }
class DesktopCaptureApiMediaPickerWithoutOptionsTest
: public DesktopCaptureApiMediaPickerOptionsBaseTest { … };
IN_PROC_BROWSER_TEST_F(DesktopCaptureApiMediaPickerWithoutOptionsTest,
FromServiceWorker) { … }
}