#include "base/strings/utf_string_conversions.h"
#include "base/test/bind.h"
#include "build/build_config.h"
#include "chrome/browser/browser_features.h"
#include "chrome/browser/external_protocol/external_protocol_handler.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/policy/core/common/policy_pref_names.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/browser_context.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/fenced_frame_test_util.h"
#include "content/public/test/navigation_handle_observer.h"
#include "content/public/test/test_navigation_observer.h"
class ExternalProtocolHandlerBrowserTest : public InProcessBrowserTest { … };
class ExternalProtocolHandlerSandboxBrowserTest
: public ExternalProtocolHandlerBrowserTest { … };
class TabAddedRemovedObserver : public TabStripModelObserver { … };
#if BUILDFLAG(IS_MAC)
#define MAYBE_AutoCloseTabOnNonWebProtocolNavigation …
#else
#define MAYBE_AutoCloseTabOnNonWebProtocolNavigation …
#endif
IN_PROC_BROWSER_TEST_F(ExternalProtocolHandlerBrowserTest,
MAYBE_AutoCloseTabOnNonWebProtocolNavigation) { … }
#if BUILDFLAG(IS_MAC)
#define MAYBE_ProtocolLaunchEmitsConsoleLog …
#else
#define MAYBE_ProtocolLaunchEmitsConsoleLog …
#endif
IN_PROC_BROWSER_TEST_F(ExternalProtocolHandlerBrowserTest,
MAYBE_ProtocolLaunchEmitsConsoleLog) { … }
IN_PROC_BROWSER_TEST_F(ExternalProtocolHandlerBrowserTest,
ProtocolFailureEmitsConsoleLog) { … }
IN_PROC_BROWSER_TEST_F(ExternalProtocolHandlerSandboxBrowserTest, Sandbox) { … }
IN_PROC_BROWSER_TEST_F(ExternalProtocolHandlerSandboxBrowserTest, SandboxAll) { … }
IN_PROC_BROWSER_TEST_F(ExternalProtocolHandlerSandboxBrowserTest,
SandboxAllowPopups) { … }
IN_PROC_BROWSER_TEST_F(ExternalProtocolHandlerSandboxBrowserTest,
SandboxAllowTopNavigationToCustomProtocols) { … }
IN_PROC_BROWSER_TEST_F(ExternalProtocolHandlerSandboxBrowserTest,
SandboxAllowTopNavigation) { … }
IN_PROC_BROWSER_TEST_F(ExternalProtocolHandlerSandboxBrowserTest,
SandboxAllowTopNavigationByUserActivation) { … }
IN_PROC_BROWSER_TEST_F(ExternalProtocolHandlerSandboxBrowserTest,
SandboxAllowTopNavigationByUserActivationWithGesture) { … }
namespace {
class AlwaysBlockedExternalProtocolHandlerDelegate
: public ExternalProtocolHandler::Delegate { … };
}
IN_PROC_BROWSER_TEST_F(ExternalProtocolHandlerBrowserTest,
ProtocolLaunchEmitsConsoleLogInCorrectFrame) { … }
class ExternalProtocolHandlerSandboxFencedFrameBrowserTest
: public ExternalProtocolHandlerSandboxBrowserTest { … };
IN_PROC_BROWSER_TEST_F(ExternalProtocolHandlerSandboxFencedFrameBrowserTest,
SandboxAllWithoutGesture) { … }
IN_PROC_BROWSER_TEST_F(ExternalProtocolHandlerSandboxFencedFrameBrowserTest,
SandboxAllWithGesture) { … }
IN_PROC_BROWSER_TEST_F(ExternalProtocolHandlerSandboxFencedFrameBrowserTest,
SandboxInFencedFrame) { … }
IN_PROC_BROWSER_TEST_F(ExternalProtocolHandlerSandboxFencedFrameBrowserTest,
SandboxAllInFencedFrame) { … }
IN_PROC_BROWSER_TEST_F(ExternalProtocolHandlerSandboxFencedFrameBrowserTest,
SandboxAllowPopupsInFencedFrame) { … }
IN_PROC_BROWSER_TEST_F(ExternalProtocolHandlerSandboxFencedFrameBrowserTest,
SandboxAllowTopNavigationInFencedFrame) { … }
IN_PROC_BROWSER_TEST_F(
ExternalProtocolHandlerSandboxFencedFrameBrowserTest,
SandboxAllowTopNavigationToCustomProtocolsInFencedFrame) { … }
IN_PROC_BROWSER_TEST_F(ExternalProtocolHandlerSandboxFencedFrameBrowserTest,
SandboxAllowTopNavigationByUserActivationInFencedFrame) { … }
IN_PROC_BROWSER_TEST_F(
ExternalProtocolHandlerSandboxFencedFrameBrowserTest,
SandboxAllowTopNavigationByUserActivationWithGestureInFencedFrame) { … }