#include <utility>
#include <vector>
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/chrome_content_browser_client.h"
#include "chrome/browser/external_protocol/external_protocol_handler.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_context_menu/render_view_context_menu_browsertest_util.h"
#include "chrome/browser/site_isolation/chrome_site_per_process_test.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_features.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/guest_view/browser/guest_view_base.h"
#include "components/guest_view/browser/guest_view_manager_delegate.h"
#include "components/guest_view/browser/test_guest_view_manager.h"
#include "components/javascript_dialogs/app_modal_dialog_controller.h"
#include "components/javascript_dialogs/app_modal_dialog_view.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/common/content_features.h"
#include "content/public/common/referrer.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/hit_test_region_observer.h"
#include "content/public/test/test_navigation_observer.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/api/extensions_api_client.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "pdf/buildflags.h"
#include "third_party/blink/public/common/input/web_gesture_event.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "ui/display/display_switches.h"
#include "ui/events/base_event_utils.h"
#include "ui/gfx/geometry/point.h"
#include "url/gurl.h"
#if BUILDFLAG(ENABLE_PDF)
#include "chrome/browser/pdf/test_pdf_viewer_stream_manager.h"
#include "pdf/pdf_features.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/public/cpp/test/shell_test_api.h"
#include "ui/display/manager/display_manager.h"
#include "ui/display/screen.h"
#include "ui/display/test/display_manager_test_api.h"
#endif
namespace {
class RedirectObserver : public content::WebContentsObserver { … };
}
class SitePerProcessHighDPIExpiredCertBrowserTest
: public ChromeSitePerProcessTest { … };
double GetFrameDeviceScaleFactor(const content::ToRenderFrameHost& adapter) { … }
#if BUILDFLAG(IS_WIN)
#define MAYBE_InterstitialLoadsWithCorrectDeviceScaleFactor …
#else
#define MAYBE_InterstitialLoadsWithCorrectDeviceScaleFactor …
#endif
IN_PROC_BROWSER_TEST_F(SitePerProcessHighDPIExpiredCertBrowserTest,
MAYBE_InterstitialLoadsWithCorrectDeviceScaleFactor) { … }
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest, RenderFrameProxyHostShutdown) { … }
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest,
OriginReplicationAllowsAccessToStorage) { … }
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest, PluginWithRemoteTopFrame) { … }
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest,
AnchorCtrlClickWhenTargetIsCrossSite) { … }
#if BUILDFLAG(ENABLE_PDF)
class ChromeSitePerProcessGuestViewPDFTest : public ChromeSitePerProcessTest { … };
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessGuestViewPDFTest,
EmbeddedPDFInsideCrossOriginFrame) { … }
class ChromeSitePerProcessOopifPDFTest : public ChromeSitePerProcessTest { … };
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessOopifPDFTest,
EmbeddedPDFInsideCrossOriginFrame) { … }
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessOopifPDFTest,
AccessStorageInPDFDocument) { … }
#endif
class MailtoExternalProtocolHandlerDelegate
: public ExternalProtocolHandler::Delegate { … };
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest,
DISABLED_LaunchExternalProtocolFromSubframe) { … }
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest,
NavigateRemoteFrameAndOpenPopup) { … }
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest,
NoStopDuringTransferUntilCommit) { … }
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest,
SingleBeforeUnloadAfterRedirect) { … }
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest, PrintIgnoredInUnloadHandler) { … }
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest,
ClosePopupWithPendingNavigationInOpener) { … }
#if defined(USE_AURA)
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest, TwoFingerTapContextMenu) { … }
#endif
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest,
CrossProcessPostMessagePreservesUserGesture) { … }
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest,
TwoPostMessagesWithSameUserGesture) { … }
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest,
TwoPostMessagesToDifferentSitesWithSameUserGesture) { … }
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest,
PostMessageSendsSecondPostMessageWithUserGesture) { … }
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest,
PostMessageSenderAndReceiverRaceToCreatePopup) { … }
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest,
UserActivationVisibilityInAncestorFrame) { … }
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest,
UserActivationConsumptionAcrossFrames) { … }
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest,
UserActivationConsumptionNoopener) { … }
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest,
DISABLED_TabCloseWithCrossSiteBeforeUnloadIframe) { … }
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest,
DISABLED_TabCloseWithSameSiteBeforeUnloadIframe) { … }
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest,
CrossProcessWindowCloseWithBeforeUnloadIframe) { … }
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest,
CrossProcessWindowCloseWithTwoBeforeUnloadIframes) { … }
class ChromeSitePerProcessTestWithVerifiedUserActivation
: public ChromeSitePerProcessTest { … };
#if BUILDFLAG(IS_MAC)
#define MAYBE_UserActivationBrowserVerificationSameOriginSite …
#else
#define MAYBE_UserActivationBrowserVerificationSameOriginSite …
#endif
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTestWithVerifiedUserActivation,
MAYBE_UserActivationBrowserVerificationSameOriginSite) { … }
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest, JSPrintDuringSwap) { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest,
DISABLED_TestInitialDSFForOOPIF) {
std::string display_spec("0+0-500x500*2,0+501-500x500");
ash::ShellTestApi shell_test_api;
display::test::DisplayManagerTestApi(shell_test_api.display_manager())
.UpdateDisplay(display_spec);
ASSERT_EQ(2u, shell_test_api.display_manager()->GetNumDisplays());
display::test::DisplayManagerTestApi display_manager_test_api(
shell_test_api.display_manager());
display::Screen* screen = display::Screen::GetScreen();
int64_t display2 = display_manager_test_api.GetSecondaryDisplay().id();
screen->SetDisplayForNewWindows(display2);
Browser* browser_on_secondary_display = CreateBrowser(browser()->profile());
GURL main_url(embedded_test_server()->GetURL(
"a.com", "/cross_site_iframe_factory.html?a(b)"));
content::ProxyDSFObserver observer;
ASSERT_TRUE(
ui_test_utils::NavigateToURL(browser_on_secondary_display, main_url));
observer.WaitForOneProxyHostCreation();
EXPECT_EQ(1u, observer.num_creations());
EXPECT_EQ(1.f, observer.get_proxy_host_dsf(0));
}
#endif