#include "base/barrier_closure.h"
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/functional/callback_forward.h"
#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
#include "base/run_loop.h"
#include "base/strings/strcat.h"
#include "base/test/bind.h"
#include "base/time/time.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/media/webrtc/fake_desktop_media_picker_factory.h"
#include "chrome/browser/media/webrtc/webrtc_browsertest_base.h"
#include "chrome/browser/media/webrtc/webrtc_browsertest_common.h"
#include "chrome/browser/sessions/tab_restore_service_factory.h"
#include "chrome/browser/sessions/tab_restore_service_load_waiter.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/tab_sharing/tab_sharing_infobar_delegate.h"
#include "chrome/browser/ui/tabs/tab_enums.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/infobars/content/content_infobar_manager.h"
#include "components/infobars/core/infobar.h"
#include "components/infobars/core/infobar_manager.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "media/base/media_switches.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "ui/gl/gl_switches.h"
namespace {
static const char kMainWebrtcTestHtmlPage[] = …;
content::WebContents* GetWebContents(Browser* browser, int tab) { … }
content::DesktopMediaID GetDesktopMediaIDForScreen() { … }
content::DesktopMediaID GetDesktopMediaIDForTab(Browser* browser, int tab) { … }
infobars::ContentInfoBarManager* GetInfoBarManager(Browser* browser, int tab) { … }
infobars::ContentInfoBarManager* GetInfoBarManager(
content::WebContents* contents) { … }
TabSharingInfoBarDelegate* GetDelegate(Browser* browser, int tab) { … }
class InfobarUIChangeObserver : public TabStripModelObserver { … };
}
class WebRtcDesktopCaptureBrowserTest : public WebRtcTestBase { … };
#if BUILDFLAG(IS_MAC)
#define MAYBE_TabCaptureProvidesMinFps …
#elif defined(MEMORY_SANITIZER)
#define MAYBE_TabCaptureProvidesMinFps …
#else
#define MAYBE_TabCaptureProvidesMinFps …
#endif
IN_PROC_BROWSER_TEST_F(WebRtcDesktopCaptureBrowserTest,
MAYBE_TabCaptureProvidesMinFps) { … }
#if BUILDFLAG(IS_LINUX) && \
((defined(ADDRESS_SANITIZER) && defined(LEAK_SANITIZER)) || \
defined(MEMORY_SANITIZER))
#define MAYBE_TabCaptureProvides0HzWith0MinFpsConstraintAndStaticContent …
#else
#define MAYBE_TabCaptureProvides0HzWith0MinFpsConstraintAndStaticContent …
#endif
IN_PROC_BROWSER_TEST_F(
WebRtcDesktopCaptureBrowserTest,
MAYBE_TabCaptureProvides0HzWith0MinFpsConstraintAndStaticContent) { … }
#if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) || BUILDFLAG(IS_MAC)
#define MAYBE_RunP2PScreenshareWhileSharingScreen …
#else
#define MAYBE_RunP2PScreenshareWhileSharingScreen …
#endif
IN_PROC_BROWSER_TEST_F(WebRtcDesktopCaptureBrowserTest,
MAYBE_RunP2PScreenshareWhileSharingScreen) { … }
#if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER)
#define MAYBE_RunP2PScreenshareWhileSharingTab …
#else
#define MAYBE_RunP2PScreenshareWhileSharingTab …
#endif
IN_PROC_BROWSER_TEST_F(WebRtcDesktopCaptureBrowserTest,
MAYBE_RunP2PScreenshareWhileSharingTab) { … }
IN_PROC_BROWSER_TEST_F(WebRtcDesktopCaptureBrowserTest,
SwitchSharedTabBackAndForth) { … }
IN_PROC_BROWSER_TEST_F(WebRtcDesktopCaptureBrowserTest,
CloseAndReopenNonSharedTab) { … }