#include <string>
#include "base/command_line.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/media/webrtc/webrtc_browsertest_base.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_tabstrip.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 "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 "third_party/blink/public/common/switches.h"
#include "ui/gl/gl_switches.h"
namespace {
WebContents;
const char kCapturingPage[] = …;
const char kCapturedPage[] = …;
const char kCapturedPageTitle[] = …;
enum class FocusEnumValue { … };
const char* ToString(FocusEnumValue focus_enum_value) { … }
enum class Tab { … };
}
class ConditionalFocusBrowserTest : public WebRtcTestBase { … };
#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) && defined(NDEBUG))
#define MAYBE_CapturedTabFocusedIfNoExplicitCallToFocus …
#else
#define MAYBE_CapturedTabFocusedIfNoExplicitCallToFocus …
#endif
IN_PROC_BROWSER_TEST_F(ConditionalFocusBrowserTest,
MAYBE_CapturedTabFocusedIfNoExplicitCallToFocus) { … }
#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) && defined(NDEBUG))
#define MAYBE_CapturedTabFocusedIfExplicitlyCallingFocus …
#else
#define MAYBE_CapturedTabFocusedIfExplicitlyCallingFocus …
#endif
IN_PROC_BROWSER_TEST_F(ConditionalFocusBrowserTest,
MAYBE_CapturedTabFocusedIfExplicitlyCallingFocus) { … }
class ConditionalFocusBrowserTestWithFocusCapturingApplication
: public ConditionalFocusBrowserTest,
public testing::WithParamInterface<FocusEnumValue> { … };
INSTANTIATE_TEST_SUITE_P(…);
#if BUILDFLAG(IS_LINUX) && defined(THREAD_SANITIZER)
#define MAYBE_CapturedTabNotFocusedIfExplicitlyCallingNoFocus …
#else
#define MAYBE_CapturedTabNotFocusedIfExplicitlyCallingNoFocus …
#endif
IN_PROC_BROWSER_TEST_P(ConditionalFocusBrowserTestWithFocusCapturingApplication,
MAYBE_CapturedTabNotFocusedIfExplicitlyCallingNoFocus) { … }
#if BUILDFLAG(IS_LINUX) && defined(THREAD_SANITIZER)
#define MAYBE_CapturedTabFocusedIfAppWaitsTooLongBeforeCallingFocus …
#else
#define MAYBE_CapturedTabFocusedIfAppWaitsTooLongBeforeCallingFocus …
#endif
IN_PROC_BROWSER_TEST_P(
ConditionalFocusBrowserTestWithFocusCapturingApplication,
MAYBE_CapturedTabFocusedIfAppWaitsTooLongBeforeCallingFocus) { … }
IN_PROC_BROWSER_TEST_F(ConditionalFocusBrowserTest, FocusTriggeredByMicrotask) { … }
IN_PROC_BROWSER_TEST_F(ConditionalFocusBrowserTest,
UserFocusChangeSuppressesFocusDecision) { … }
IN_PROC_BROWSER_TEST_F(ConditionalFocusBrowserTest,
ExceptionRaisedIfFocusCalledAfterMicrotaskExecutes) { … }
IN_PROC_BROWSER_TEST_F(ConditionalFocusBrowserTest, FocusBeforeCapture) { … }
#if BUILDFLAG(IS_LINUX) && defined(THREAD_SANITIZER)
#define MAYBE_NoFocusBeforeCapture …
#else
#define MAYBE_NoFocusBeforeCapture …
#endif
IN_PROC_BROWSER_TEST_P(ConditionalFocusBrowserTestWithFocusCapturingApplication,
MAYBE_NoFocusBeforeCapture) { … }
#if BUILDFLAG(IS_LINUX) && defined(THREAD_SANITIZER)
#define MAYBE_NoFocusAfterCaptureOverrideFocusBeforeCapture …
#else
#define MAYBE_NoFocusAfterCaptureOverrideFocusBeforeCapture …
#endif
IN_PROC_BROWSER_TEST_P(ConditionalFocusBrowserTestWithFocusCapturingApplication,
MAYBE_NoFocusAfterCaptureOverrideFocusBeforeCapture) { … }
#if BUILDFLAG(IS_LINUX) && defined(THREAD_SANITIZER)
#define MAYBE_FocusAfterCaptureOverrideNoFocusBeforeCapture …
#else
#define MAYBE_FocusAfterCaptureOverrideNoFocusBeforeCapture …
#endif
IN_PROC_BROWSER_TEST_P(ConditionalFocusBrowserTestWithFocusCapturingApplication,
MAYBE_FocusAfterCaptureOverrideNoFocusBeforeCapture) { … }