#include "content/browser/site_per_process_browsertest.h"
#include <stddef.h>
#include <stdint.h>
#include <algorithm>
#include <cmath>
#include <list>
#include <map>
#include <memory>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/json/json_reader.h"
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_ref.h"
#include "base/memory/scoped_refptr.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/scoped_observation.h"
#include "base/strings/pattern.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/run_until.h"
#include "base/test/test_future.h"
#include "base/test/test_timeouts.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "cc/base/math_util.h"
#include "cc/input/touch_action.h"
#include "components/input/input_router.h"
#include "components/input/render_widget_host_input_event_router.h"
#include "components/input/switches.h"
#include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/gpu/compositor_util.h"
#include "content/browser/process_lock.h"
#include "content/browser/renderer_host/agent_scheduling_group_host.h"
#include "content/browser/renderer_host/cross_process_frame_connector.h"
#include "content/browser/renderer_host/frame_navigation_entry.h"
#include "content/browser/renderer_host/frame_tree.h"
#include "content/browser/renderer_host/navigation_controller_impl.h"
#include "content/browser/renderer_host/navigation_entry_impl.h"
#include "content/browser/renderer_host/navigation_entry_restore_context_impl.h"
#include "content/browser/renderer_host/navigation_request.h"
#include "content/browser/renderer_host/navigator.h"
#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/browser/renderer_host/render_frame_proxy_host.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_child_frame.h"
#include "content/browser/site_info.h"
#include "content/browser/storage_partition_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/content_navigation_policy.h"
#include "content/common/frame.mojom-test-utils.h"
#include "content/common/input/actions_parser.h"
#include "content/common/input/synthetic_gesture.h"
#include "content/common/input/synthetic_gesture_target.h"
#include "content/common/input/synthetic_pinch_gesture_params.h"
#include "content/common/input/synthetic_pointer_action.h"
#include "content/common/input/synthetic_tap_gesture.h"
#include "content/common/input/synthetic_touchscreen_pinch_gesture.h"
#include "content/common/renderer.mojom.h"
#include "content/common/renderer_host.mojom-test-utils.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/context_menu_params.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/browser/javascript_dialog_manager.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_process_host_priority_client.h"
#include "content/public/browser/site_isolation_policy.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h"
#include "content/public/test/back_forward_cache_util.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test_content_browser_client.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/public/test/content_mock_cert_verifier.h"
#include "content/public/test/fenced_frame_test_util.h"
#include "content/public/test/hit_test_region_observer.h"
#include "content/public/test/navigation_handle_observer.h"
#include "content/public/test/policy_container_utils.h"
#include "content/public/test/render_frame_host_test_support.h"
#include "content/public/test/test_devtools_protocol_client.h"
#include "content/public/test/test_frame_navigation_observer.h"
#include "content/public/test/test_navigation_observer.h"
#include "content/public/test/test_navigation_throttle.h"
#include "content/public/test/test_navigation_throttle_inserter.h"
#include "content/public/test/test_utils.h"
#include "content/public/test/url_loader_interceptor.h"
#include "content/shell/browser/shell.h"
#include "content/shell/common/main_frame_counter_test_impl.h"
#include "content/shell/common/shell_switches.h"
#include "content/test/content_browser_test_utils_internal.h"
#include "content/test/did_commit_navigation_interceptor.h"
#include "content/test/render_document_feature.h"
#include "ipc/constants.mojom.h"
#include "ipc/ipc_security_test_util.h"
#include "media/base/media_switches.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/test_support/test_utils.h"
#include "net/base/url_util.h"
#include "net/dns/mock_host_resolver.h"
#include "net/http/mock_http_cache.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/web_sandbox_flags.h"
#include "services/network/public/mojom/web_sandbox_flags.mojom-shared.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "third_party/blink/public/common/permissions_policy/origin_with_possible_wildcards.h"
#include "third_party/blink/public/common/permissions_policy/permissions_policy.h"
#include "third_party/blink/public/common/permissions_policy/policy_value.h"
#include "third_party/blink/public/common/switches.h"
#include "third_party/blink/public/common/tokens/tokens.h"
#include "third_party/blink/public/mojom/frame/frame.mojom-test-utils.h"
#include "third_party/blink/public/mojom/frame/frame.mojom.h"
#include "third_party/blink/public/mojom/frame/frame_replication_state.mojom.h"
#include "third_party/blink/public/mojom/leak_detector/leak_detector.mojom-test-utils.h"
#include "third_party/blink/public/mojom/leak_detector/leak_detector.mojom.h"
#include "third_party/blink/public/mojom/page/widget.mojom-test-utils.h"
#include "third_party/blink/public/mojom/security_context/insecure_request_policy.mojom.h"
#include "ui/display/display_switches.h"
#include "ui/display/screen.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/blink/blink_features.h"
#include "ui/events/event.h"
#include "ui/events/event_utils.h"
#include "ui/events/keycodes/dom/dom_code.h"
#include "ui/events/keycodes/dom/dom_key.h"
#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/transform.h"
#include "ui/latency/latency_info.h"
#include "ui/native_theme/native_theme_features.h"
#if defined(USE_AURA)
#include "content/browser/renderer_host/render_widget_host_view_aura.h"
#include "ui/aura/window.h"
#endif
#if BUILDFLAG(IS_ANDROID)
#include "base/android/jni_android.h"
#include "base/android/jni_string.h"
#include "base/android/scoped_java_ref.h"
#include "content/browser/android/gesture_listener_manager.h"
#include "content/browser/android/ime_adapter_android.h"
#include "content/browser/renderer_host/input/touch_selection_controller_client_manager_android.h"
#include "content/browser/renderer_host/render_widget_host_view_android.h"
#include "content/browser/web_contents/web_contents_view_android.h"
#include "content/public/browser/android/child_process_importance.h"
#include "content/test/mock_overscroll_refresh_handler_android.h"
#include "ui/android/view_android.h"
#include "ui/android/window_android.h"
#include "ui/events/android/event_handler_android.h"
#include "ui/events/android/motion_event_android.h"
#include "ui/gfx/geometry/point_f.h"
#endif
SizeIs;
WhenSorted;
ElementsAre;
namespace content {
namespace {
void VerifyChildProcessHasMainFrame(
mojo::Remote<mojom::MainFrameCounterTest>& main_frame_counter,
bool expected_state) { … }
CrashVisibility;
void PostMessageAndWaitForReply(FrameTreeNode* sender_ftn,
const std::string& post_message_script,
const std::string& reply_status) { … }
int GetReceivedMessages(FrameTreeNode* ftn) { … }
void NavigateNamedFrame(const ToRenderFrameHost& caller_frame,
const GURL& url,
const std::string& name) { … }
void SimulateMouseClick(RenderWidgetHost* rwh, int x, int y) { … }
EvalJsResult GetOriginFromRenderer(FrameTreeNode* ftn) { … }
class UserInteractionObserver : public WebContentsObserver { … };
class VisibleSecurityStateObserver : public WebContentsObserver { … };
void FocusFrame(FrameTreeNode* frame) { … }
bool ConvertJSONToPoint(const std::string& str, gfx::PointF* point) { … }
blink::ParsedPermissionsPolicyDeclaration
CreateParsedPermissionsPolicyDeclaration(
blink::mojom::PermissionsPolicyFeature feature,
const std::vector<GURL>& origins,
bool match_all_origins = false,
const std::optional<GURL> self_if_matches = std::nullopt) { … }
blink::ParsedPermissionsPolicy CreateParsedPermissionsPolicy(
const std::vector<blink::mojom::PermissionsPolicyFeature>& features,
const std::vector<GURL>& origins,
bool match_all_origins = false,
const std::optional<GURL> self_if_matches = std::nullopt) { … }
blink::ParsedPermissionsPolicy CreateParsedPermissionsPolicyMatchesSelf(
const std::vector<blink::mojom::PermissionsPolicyFeature>& features,
const GURL& self_if_matches) { … }
blink::ParsedPermissionsPolicy CreateParsedPermissionsPolicyMatchesAll(
const std::vector<blink::mojom::PermissionsPolicyFeature>& features) { … }
blink::ParsedPermissionsPolicy CreateParsedPermissionsPolicyMatchesNone(
const std::vector<blink::mojom::PermissionsPolicyFeature>& features) { … }
void CheckFrameDepth(unsigned int expected_depth, FrameTreeNode* node) { … }
void GenerateTapDownGesture(RenderWidgetHost* rwh) { … }
}
SitePerProcessBrowserTestBase::SitePerProcessBrowserTestBase() { … }
std::string SitePerProcessBrowserTestBase::DepictFrameTree(
FrameTreeNode* node) { … }
std::string SitePerProcessBrowserTestBase::WaitForMessageScript(
const std::string& result_expression) { … }
void SitePerProcessBrowserTestBase::SetUpCommandLine(
base::CommandLine* command_line) { … }
void SitePerProcessBrowserTestBase::SetUpOnMainThread() { … }
void SitePerProcessBrowserTestBase::ForceUpdateViewportIntersection(
FrameTreeNode* frame_tree_node,
const blink::mojom::ViewportIntersectionState& intersection_state) { … }
void SitePerProcessBrowserTestBase::RunPostedTasks() { … }
SitePerProcessBrowserTest::SitePerProcessBrowserTest() { … }
std::string SitePerProcessBrowserTest::GetExpectedOrigin(
const std::string& host) { … }
void SitePerProcessIgnoreCertErrorsBrowserTest::SetUpOnMainThread() { … }
void SitePerProcessIgnoreCertErrorsBrowserTest::SetUpCommandLine(
base::CommandLine* command_line) { … }
void SitePerProcessIgnoreCertErrorsBrowserTest::
SetUpInProcessBrowserTestFixture() { … }
void SitePerProcessIgnoreCertErrorsBrowserTest::
TearDownInProcessBrowserTestFixture() { … }
class SitePerProcessAutoplayBrowserTest : public SitePerProcessBrowserTest { … };
class SitePerProcessBrowserTestWithoutSpeculativeRFHDelay
: public SitePerProcessBrowserTest { … };
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, CrossSiteIframe) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
CrossSiteIframeMainFrameCount) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, TitleAfterCrossSiteIframe) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
GestureFlingStartEventsBubble) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
TouchscreenGestureFlingStart) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, TouchpadGestureFlingStart) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, CompositorFrameSwapped) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, CleanupCrossSiteIframe) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, NavigateRemoteFrame) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
NavigateRemoteFrameToBlankAndDataURLs) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
NavigateRemoteFrameToKilledProcess) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, RemoveFocusFromKilledFrame) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
NavigateRemoteFrameToKilledProcessWithSubtree) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, NavigateRemoteAfterError) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, ProcessTransferAfterError) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
NavigatingToKilledProcessRestoresAllProxies) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
CreateChildFrameAfterKillingProcess) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
CreateChildFrameAfterKillingOpener) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
KillingRendererClearsDescendantProxies) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, CrashSubframe) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, CreateProxiesForNewFrames) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
DISABLED_CrossSiteIframeRedirectOnce) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
DISABLED_CrossSiteIframeRedirectTwice) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, ProxyCreationSkipsSubtree) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, OriginReplication) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessAutoplayBrowserTest,
DISABLED_PropagateUserGestureFlag) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, SandboxFlagsReplication) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, DynamicSandboxFlags) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
DynamicSandboxFlagsRemoteToLocal) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
DynamicSandboxFlagsRendererInitiatedNavigation) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
ProxiesForNewChildFramesHaveCorrectReplicationState) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, WindowNameReplication) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, DynamicWindowName) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, OriginUpdatesReachProxies) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, CrossSiteDidStopLoading) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
NavigateWithSiblingRemoteFrame) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
NavigateSiblingsToSameProcess) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, LoadEventForwarding) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, SubframePostMessage) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
PostMessageWithSubframeOnOpenerChain) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, IndexedFrameAccess) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, RFPHDestruction) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, OpenPopupWithRemoteParent) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, NavigatePopupToIllegalURL) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
DiscoverNamedFrameFromAncestorOfOpener) { … }
class SitePerProcessFencedFrameTest : public SitePerProcessBrowserTestBase { … };
IN_PROC_BROWSER_TEST_F(SitePerProcessFencedFrameTest,
PopupFromFencedFrameDoesNotCreateProxy) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
DiscoverFrameAfterSettingWindowName) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, UpdateSubframeOpener) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
NavigatingSubframePreservesOpenerInParent) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, NavigateSubframeWithOpener) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
NewRenderFrameProxyPreservesOpener) { … }
#if BUILDFLAG(IS_MAC)
#define MAYBE_RenderViewHostIsNotReusedAfterDelayedUnloadACK …
#else
#define MAYBE_RenderViewHostIsNotReusedAfterDelayedUnloadACK …
#endif
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
MAYBE_RenderViewHostIsNotReusedAfterDelayedUnloadACK) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
ReusePendingDeleteRenderViewHostForSubframe) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
CrossProcessFocusChangeFiresBlurEvents) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, DocumentActiveElement) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, SubframeWindowFocus) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
SubframeFocusNotLostWhenAnotherFrameNavigatesCrossSite) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, OpenerSetLocation) { … }
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
#define MAYBE_NavigateProxyAndDetachBeforeProvisionalFrameCreation …
#else
#define MAYBE_NavigateProxyAndDetachBeforeProvisionalFrameCreation …
#endif
IN_PROC_BROWSER_TEST_P(
SitePerProcessBrowserTest,
MAYBE_NavigateProxyAndDetachBeforeProvisionalFrameCreation) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
NavigateProxyAndDetachBeforeCommit) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, NavigateAboutBlankAndDetach) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
SubframePendingAndBackToSameSiteInstance) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, ParentDetachRemoteChild) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, SandboxFlagsInheritance) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
SandboxFlagsNotInheritedBeforeNavigation) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
NewPopupInheritsSandboxFlagsFromOpener) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
OpenUnsandboxedPopupFromSandboxedFrame) { … }
IN_PROC_BROWSER_TEST_P(
SitePerProcessBrowserTest,
OpenSandboxedDocumentInUnsandboxedPopupFromSandboxedFrame) { … }
IN_PROC_BROWSER_TEST_P(
SitePerProcessBrowserTest,
OpenSandboxedDocumentInUnsandboxedPopupFromCSPSandboxedDocument) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessIgnoreCertErrorsBrowserTest,
DISABLED_SubresourceWithCertificateErrors) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, CrossSiteIframeDisplayNone) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
CrossSiteIframeBlockedByXFrameOptionsOrCSP) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
CrossSiteIframeBlockedByParentCSPFromHeaders) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
CrossSiteIframeBlockedByParentCSPFromMeta) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
CrossSiteIframeBlockedByCSPInheritedBySrcDocParent) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
NavigateMainFrameToChildSite) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
CloseSubframeWidgetAndViewOnProcessExit) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
UserInteractionForChildFrameTest) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
NavigateSubframeToDataUrlInSessionHistory) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, DataUrlsHaveUniqueSiteURLs) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
SubframeDataUrlsAfterRestore) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
SubframeBlankUrlsAfterRestore) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
SubframeSrcdocUrlAfterRestore) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
NavigateSubframeToAboutBlankInSessionHistory) { … }
class ShowCreatedWindowInterceptor
: public blink::mojom::LocalMainFrameHostInterceptorForTesting { … };
class NewWindowCreatedObserver : public WebContentsObserver { … };
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
TwoSubframesCreatePopupsSimultaneously) { … }
class RequestCloseWidgetInterceptor
: public blink::mojom::PopupWidgetHostInterceptorForTesting { … };
class ShowCreatedPopupWidgetInterceptor
: public blink::mojom::PopupWidgetHostInterceptorForTesting { … };
class NewPopupWidgetCreatedObserver { … };
#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
#define MAYBE_TwoSubframesCreatePopupMenuWidgetsSimultaneously …
#else
#define MAYBE_TwoSubframesCreatePopupMenuWidgetsSimultaneously …
#endif
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
MAYBE_TwoSubframesCreatePopupMenuWidgetsSimultaneously) { … }
#endif
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, FileChooserInSubframe) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
PendingRFHIsCanceledWhenItsProcessDies) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
RenderViewHostKeepsSwappedOutStateIfPendingRFHDies) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
NavigateCrashedSubframeToSameSite) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, SessionHistoryReplication) { … }
class DispatchLoadInterceptor
: public blink::mojom::LocalFrameHostInterceptorForTesting { … };
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
LoadEventForwardingWhilePendingDeletion) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
RFHTransfersWhilePendingDeletion) { … }
class NavigationHandleWatcher : public WebContentsObserver { … };
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
NavigationHandleSiteInstance) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
ReuseNonLiveRenderViewHostAfterCancelPending) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
RecreateMainFrameAfterCancelPending) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTestWithoutSpeculativeRFHDelay,
CommunicateWithProxyAfterCancelPending) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
HeaderPolicyOnXSLTNavigation) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
TestPolicyReplicationOnSameOriginNavigation) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
TestPolicyReplicationOnCrossOriginNavigation) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
TestPolicyReplicationFromRemoteFrames) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
TestPermissionsPolicyReplicationToProxyOnNavigation) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
TestAllowAttributeInSandboxedFrame) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
TestAllowAttributeInOpaqueOriginAfterNavigation) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
IframeSrcdocAfterCrossSiteNavigation) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
RemoteToLocalNavigationInCrashedSubframe) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
ContextMenuAfterCrossProcessNavigation) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, ContainerPolicy) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, ContainerPolicyDynamic) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
ContainerPolicyCrossOriginNavigation) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
ContainerPolicySandboxDynamic) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
PermissionsPolicyConstructionInExistingProxy) { … }
class RequestDelayingSitePerProcessBrowserTest
: public SitePerProcessBrowserTest { … };
IN_PROC_BROWSER_TEST_P(RequestDelayingSitePerProcessBrowserTest,
DelayableSubframeRequestsOneFrame) { … }
IN_PROC_BROWSER_TEST_P(RequestDelayingSitePerProcessBrowserTest,
DelayableSubframeRequestsTwoFrames) { … }
#if BUILDFLAG(IS_ANDROID)
class TextSelectionObserver : public TextInputManager::Observer {
public:
explicit TextSelectionObserver(TextInputManager* text_input_manager)
: text_input_manager_(text_input_manager) {
text_input_manager->AddObserver(this);
}
TextSelectionObserver(const TextSelectionObserver&) = delete;
TextSelectionObserver& operator=(const TextSelectionObserver&) = delete;
~TextSelectionObserver() { text_input_manager_->RemoveObserver(this); }
void WaitForSelectedText(const std::string& expected_text) {
if (last_selected_text_ == expected_text)
return;
expected_text_ = expected_text;
loop_runner_ = new MessageLoopRunner();
loop_runner_->Run();
}
private:
void OnTextSelectionChanged(TextInputManager* text_input_manager,
RenderWidgetHostViewBase* updated_view) override {
last_selected_text_ = base::UTF16ToUTF8(
text_input_manager->GetTextSelection(updated_view)->selected_text());
if (last_selected_text_ == expected_text_ && loop_runner_)
loop_runner_->Quit();
}
const raw_ptr<TextInputManager> text_input_manager_;
std::string last_selected_text_;
std::string expected_text_;
scoped_refptr<MessageLoopRunner> loop_runner_;
};
class SitePerProcessAndroidImeTest : public SitePerProcessBrowserTest {
public:
SitePerProcessAndroidImeTest() : SitePerProcessBrowserTest() {}
SitePerProcessAndroidImeTest(const SitePerProcessAndroidImeTest&) = delete;
SitePerProcessAndroidImeTest& operator=(const SitePerProcessAndroidImeTest&) =
delete;
~SitePerProcessAndroidImeTest() override {}
protected:
ImeAdapterAndroid* ime_adapter() {
return static_cast<RenderWidgetHostViewAndroid*>(
web_contents()->GetRenderWidgetHostView())
->ime_adapter_for_testing();
}
void FocusInputInFrame(RenderFrameHostImpl* frame) {
ASSERT_TRUE(ExecJs(frame, "window.focus(); input.focus();"));
}
void LoadPage() {
ASSERT_TRUE(NavigateToURL(
shell(),
GURL(embedded_test_server()->GetURL(
"a.com", "/cross_site_iframe_factory.html?a(b,c(a(b)))"))));
FrameTreeNode* root = web_contents()->GetPrimaryFrameTree().root();
frames_.push_back(root->current_frame_host());
frames_.push_back(root->child_at(0)->current_frame_host());
frames_.push_back(root->child_at(1)->current_frame_host());
frames_.push_back(root->child_at(1)->child_at(0)->current_frame_host());
frames_.push_back(
root->child_at(1)->child_at(0)->child_at(0)->current_frame_host());
std::string add_input_script =
"var input = document.createElement('input');"
"document.body.appendChild(input);"
"window.oninput = function() {"
" input.select();"
"};";
for (content::RenderFrameHostImpl* frame : frames_) {
ASSERT_TRUE(ExecJs(frame, add_input_script));
}
}
void CommitText(const char* text) {
JNIEnv* env = base::android::AttachCurrentThread();
base::android::ScopedJavaLocalRef<jobject> caller =
ime_adapter()->java_ime_adapter_for_testing(env);
base::android::ScopedJavaLocalRef<jstring> jtext =
base::android::ConvertUTF8ToJavaString(env, text);
ime_adapter()->CommitText(
env, base::android::JavaParamRef<jobject>(env, caller.obj()),
base::android::JavaParamRef<jobject>(env, jtext.obj()),
base::android::JavaParamRef<jstring>(env, jtext.obj()), 0);
}
std::vector<raw_ptr<RenderFrameHostImpl, VectorExperimental>> frames_;
};
IN_PROC_BROWSER_TEST_P(SitePerProcessAndroidImeTest,
CommitTextForFocusedWidget) {
LoadPage();
TextSelectionObserver selection_observer(
web_contents()->GetTextInputManager());
for (size_t index = 0; index < frames_.size(); ++index) {
std::string text = base::StringPrintf("text%zu", index);
FocusInputInFrame(frames_[index]);
CommitText(text.c_str());
selection_observer.WaitForSelectedText(text);
}
}
#endif
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
SubframeTransfersToCurrentRFH) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
FrameSwapPreservesUniqueName) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, PostTargetSubFrame) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
PostTargetsMainFrameFromOOPIF) { … }
IN_PROC_BROWSER_TEST_P(
SitePerProcessBrowserTest,
DISABLED_CrossProcessMainFrameNavigationDoesNotOverwriteHistory) { … }
#if BUILDFLAG(IS_POSIX)
#define MAYBE_CrossProcessInertSubframe …
#else
#define MAYBE_CrossProcessInertSubframe …
#endif
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
MAYBE_CrossProcessInertSubframe) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
CrossProcessIsInertPropagation) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
MainFrameProcessReuseWhenOverLimit) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
SubframeProcessReuseWhenOverLimit) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
TwoCrossSitePendingNavigationsAndMainFrameWins) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
TwoCrossSitePendingNavigationsAndSubframeWins) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
TwoCrossSitePendingNavigationsWithOpener) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
DetachSpeculativeRenderFrameHost) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
CancelNavigationAfterReadyToCommit) { … }
namespace {
class AssertNoReadyToCommitNavigationCalls : public WebContentsObserver { … };
}
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
ObjectTagSameSiteNavigationWithHTTPError) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTestWithoutSpeculativeRFHDelay,
ObjectTagCrossSiteNavigationWithHTTPError) { … }
IN_PROC_BROWSER_TEST_P(
SitePerProcessBrowserTest,
ObjectTagSameSiteNavigationWithHTTPErrorAndFailedBodyLoad) { … }
IN_PROC_BROWSER_TEST_P(
SitePerProcessBrowserTestWithoutSpeculativeRFHDelay,
ObjectTagCrossSiteNavigationWithHTTPErrorAndFailedBodyLoad) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTestWithoutSpeculativeRFHDelay,
ObjectTagSameSiteNavigationWithNetworkError) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTestWithoutSpeculativeRFHDelay,
ObjectTagCrossSiteNavigationWithNetworkError) { … }
class SitePerProcessBrowserTestWithLeakDetector
: public SitePerProcessBrowserTest { … };
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTestWithLeakDetector,
CloseWebContentsWithSpeculativeRenderFrameHost) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTestWithLeakDetector,
DetachFrameWithSpeculativeRenderFrameHost) { … }
#if BUILDFLAG(IS_ANDROID)
namespace {
class MockEventHandlerAndroid : public ui::EventHandlerAndroid {
public:
bool OnTouchEvent(const ui::MotionEventAndroid& event) override {
did_receive_event_ = true;
return true;
}
bool did_receive_event() { return did_receive_event_; }
private:
bool did_receive_event_ = false;
};
}
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
SpeculativeRenderFrameHostDoesNotReceiveInput) {
GURL url1(embedded_test_server()->GetURL("a.com", "/title1.html"));
EXPECT_TRUE(NavigateToURL(shell(), url1));
RenderWidgetHostViewAndroid* rwhva =
static_cast<RenderWidgetHostViewAndroid*>(
shell()->web_contents()->GetRenderWidgetHostView());
ui::ViewAndroid* rwhva_native_view = rwhva->GetNativeView();
FrameTreeNode* root = web_contents()->GetPrimaryFrameTree().root();
GURL url2(embedded_test_server()->GetURL("b.com", "/title2.html"));
TestNavigationManager nav_manager(web_contents(), url2);
shell()->LoadURL(url2);
nav_manager.WaitForSpeculativeRenderFrameHostCreation();
RenderFrameHostImpl* root_speculative_rfh =
root->render_manager()->speculative_frame_host();
EXPECT_TRUE(root_speculative_rfh);
RenderWidgetHostViewAndroid* rwhv_speculative =
static_cast<RenderWidgetHostViewAndroid*>(
root_speculative_rfh->GetView());
ui::ViewAndroid* rwhv_speculative_native_view =
rwhv_speculative->GetNativeView();
ui::ViewAndroid* root_view = web_contents()->GetView()->GetNativeView();
EXPECT_TRUE(root_view);
MockEventHandlerAndroid mock_handler;
rwhva_native_view->set_event_handler(&mock_handler);
MockEventHandlerAndroid mock_handler_speculative;
rwhv_speculative_native_view->set_event_handler(&mock_handler_speculative);
root_view->set_event_handler(nullptr);
auto size = root_view->GetSize();
float x = size.width() / 2;
float y = size.height() / 2;
ui::MotionEventAndroid::Pointer pointer0(0, x, y, 0, 0, 0, 0, 0);
ui::MotionEventAndroid::Pointer pointer1(0, 0, 0, 0, 0, 0, 0, 0);
ui::MotionEventAndroid event(nullptr, nullptr, 1.f / root_view->GetDipScale(),
0.f, 0.f, 0.f, base::TimeTicks(), 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, false, &pointer0, &pointer1);
root_view->OnTouchEventForTesting(event);
EXPECT_TRUE(mock_handler.did_receive_event());
EXPECT_FALSE(mock_handler_speculative.did_receive_event());
}
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, TestChildProcessImportance) {
web_contents()->SetPrimaryMainFrameImportance(
ChildProcessImportance::MODERATE);
GURL main_url(embedded_test_server()->GetURL(
"a.com", "/cross_site_iframe_factory.html?a(b)"));
EXPECT_TRUE(NavigateToURL(shell(), main_url));
FrameTreeNode* root = web_contents()->GetPrimaryFrameTree().root();
ASSERT_EQ(1u, root->child_count());
FrameTreeNode* child = root->child_at(0);
EXPECT_EQ(ChildProcessImportance::MODERATE,
root->current_frame_host()->GetProcess()->GetEffectiveImportance());
EXPECT_EQ(
ChildProcessImportance::NORMAL,
child->current_frame_host()->GetProcess()->GetEffectiveImportance());
web_contents()->SetPrimaryMainFrameImportance(ChildProcessImportance::NORMAL);
EXPECT_EQ(ChildProcessImportance::NORMAL,
root->current_frame_host()->GetProcess()->GetEffectiveImportance());
EXPECT_EQ(
ChildProcessImportance::NORMAL,
child->current_frame_host()->GetProcess()->GetEffectiveImportance());
web_contents()->SetPrimaryMainFrameImportance(
ChildProcessImportance::IMPORTANT);
EXPECT_EQ(ChildProcessImportance::IMPORTANT,
root->current_frame_host()->GetProcess()->GetEffectiveImportance());
EXPECT_EQ(
ChildProcessImportance::NORMAL,
child->current_frame_host()->GetProcess()->GetEffectiveImportance());
int old_child_process_id = child->current_frame_host()->GetProcess()->GetID();
GURL url = embedded_test_server()->GetURL("foo.com", "/title2.html");
EXPECT_TRUE(NavigateToURLFromRenderer(root->child_at(0), url));
int new_child_process_id = child->current_frame_host()->GetProcess()->GetID();
EXPECT_NE(old_child_process_id, new_child_process_id);
EXPECT_EQ(
ChildProcessImportance::NORMAL,
child->current_frame_host()->GetProcess()->GetEffectiveImportance());
EXPECT_EQ(ChildProcessImportance::IMPORTANT,
root->current_frame_host()->GetProcess()->GetEffectiveImportance());
int old_root_process_id = root->current_frame_host()->GetProcess()->GetID();
child = nullptr;
EXPECT_TRUE(NavigateToURLFromRenderer(root, url));
EXPECT_EQ(0u, root->child_count());
int new_root_process_id = root->current_frame_host()->GetProcess()->GetID();
EXPECT_NE(old_root_process_id, new_root_process_id);
EXPECT_EQ(ChildProcessImportance::IMPORTANT,
root->current_frame_host()->GetProcess()->GetEffectiveImportance());
}
class TouchSelectionControllerClientTestWrapper
: public ui::TouchSelectionControllerClient {
public:
explicit TouchSelectionControllerClientTestWrapper(
ui::TouchSelectionControllerClient* client)
: expected_event_(ui::SELECTION_HANDLES_SHOWN), client_(client) {}
TouchSelectionControllerClientTestWrapper(
const TouchSelectionControllerClientTestWrapper&) = delete;
TouchSelectionControllerClientTestWrapper& operator=(
const TouchSelectionControllerClientTestWrapper&) = delete;
~TouchSelectionControllerClientTestWrapper() override {}
void InitWaitForSelectionEvent(ui::SelectionEventType expected_event) {
DCHECK(!run_loop_);
expected_event_ = expected_event;
run_loop_ = std::make_unique<base::RunLoop>();
}
void Wait() {
DCHECK(run_loop_);
run_loop_->Run();
run_loop_.reset();
}
private:
void OnSelectionEvent(ui::SelectionEventType event) override {
client_->OnSelectionEvent(event);
if (run_loop_ && event == expected_event_)
run_loop_->Quit();
}
bool SupportsAnimation() const override {
return client_->SupportsAnimation();
}
void SetNeedsAnimate() override { client_->SetNeedsAnimate(); }
void MoveCaret(const gfx::PointF& position) override {
client_->MoveCaret(position);
}
void MoveRangeSelectionExtent(const gfx::PointF& extent) override {
client_->MoveRangeSelectionExtent(extent);
}
void SelectBetweenCoordinates(const gfx::PointF& base,
const gfx::PointF& extent) override {
client_->SelectBetweenCoordinates(base, extent);
}
std::unique_ptr<ui::TouchHandleDrawable> CreateDrawable() override {
return client_->CreateDrawable();
}
void DidScroll() override {}
void OnDragUpdate(const ui::TouchSelectionDraggable::Type type,
const gfx::PointF& position) override {}
ui::SelectionEventType expected_event_;
std::unique_ptr<base::RunLoop> run_loop_;
raw_ptr<ui::TouchSelectionControllerClient, DanglingUntriaged> client_;
};
class TouchSelectionControllerClientAndroidSiteIsolationTest
: public SitePerProcessBrowserTest {
public:
TouchSelectionControllerClientAndroidSiteIsolationTest()
: root_rwhv_(nullptr),
child_rwhv_(nullptr),
child_frame_tree_node_(nullptr),
selection_controller_client_(nullptr) {}
void SetUpCommandLine(base::CommandLine* command_line) override {
SitePerProcessBrowserTestBase::SetUpCommandLine(command_line);
IsolateAllSitesForTesting(command_line);
}
RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid() {
return static_cast<RenderWidgetHostViewAndroid*>(
shell()->web_contents()->GetRenderWidgetHostView());
}
void SelectWithLongPress(gfx::Point point) {
RenderWidgetHostViewAndroid* main_view = GetRenderWidgetHostViewAndroid();
SendTouch(main_view, ui::MotionEvent::Action::DOWN, point);
DelayBy(base::Milliseconds(2000));
SendTouch(main_view, ui::MotionEvent::Action::UP, point);
}
void SimpleTap(gfx::Point point) {
RenderWidgetHostViewAndroid* main_view = GetRenderWidgetHostViewAndroid();
SendTouch(main_view, ui::MotionEvent::Action::DOWN, point);
DelayBy(base::Milliseconds(300));
SendTouch(main_view, ui::MotionEvent::Action::UP, point);
}
void SetupTest() {
GURL test_url(embedded_test_server()->GetURL(
"a.com", "/cross_site_iframe_factory.html?a(a)"));
EXPECT_TRUE(NavigateToURL(shell(), test_url));
frame_observer_ = std::make_unique<RenderFrameSubmissionObserver>(
shell()->web_contents());
FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
->GetPrimaryFrameTree()
.root();
EXPECT_EQ(
" Site A\n"
" +--Site A\n"
"Where A = http://a.com/",
FrameTreeVisualizer().DepictFrameTree(root));
TestNavigationObserver observer(shell()->web_contents());
EXPECT_EQ(1u, root->child_count());
child_frame_tree_node_ = root->child_at(0);
root_rwhv_ = static_cast<RenderWidgetHostViewAndroid*>(
root->current_frame_host()->GetRenderWidgetHost()->GetView());
selection_controller_client_ =
new TouchSelectionControllerClientTestWrapper(
root_rwhv_->GetSelectionControllerClientManagerForTesting());
root_rwhv_->SetSelectionControllerClientForTesting(
base::WrapUnique(selection_controller_client_.get()));
GURL child_url(
embedded_test_server()->GetURL("b.com", "/touch_selection.html"));
EXPECT_TRUE(
NavigateToURLFromRenderer(child_frame_tree_node_.get(), child_url));
EXPECT_EQ(
" Site A ------------ proxies for B\n"
" +--Site B ------- proxies for A\n"
"Where A = http://a.com/\n"
" B = http://b.com/",
FrameTreeVisualizer().DepictFrameTree(root));
child_frame_tree_node_ = root->child_at(0);
WaitForHitTestData(child_frame_tree_node_->current_frame_host());
child_rwhv_ = static_cast<RenderWidgetHostViewChildFrame*>(
child_frame_tree_node_->current_frame_host()
->GetRenderWidgetHost()
->GetView());
EXPECT_EQ(child_url, observer.last_navigation_url());
EXPECT_TRUE(observer.last_navigation_succeeded());
}
void ShutdownTest() {
ASSERT_TRUE(frame_observer_);
frame_observer_.reset();
}
gfx::PointF GetPointInChild() {
gfx::PointF point_f;
std::string str = EvalJs(child_frame_tree_node_->current_frame_host(),
"get_top_left_of_text()")
.ExtractString();
ConvertJSONToPoint(str, &point_f);
constexpr int kCharacterWidth = 15;
constexpr int kCharacterHeight = 15;
point_f.Offset(2 * kCharacterWidth, 0.5f * kCharacterHeight);
point_f = child_rwhv()->TransformPointToRootCoordSpaceF(point_f);
return point_f;
}
void VerifyHandlePosition() {
ui::TouchSelectionController* touch_selection_controller =
root_rwhv()->touch_selection_controller();
bool handles_in_place = false;
while (!handles_in_place) {
gfx::PointF selection_start =
touch_selection_controller->GetStartPosition();
gfx::PointF selection_end = touch_selection_controller->GetEndPosition();
gfx::RectF handle_start =
touch_selection_controller->GetStartHandleRect();
gfx::RectF handle_end = touch_selection_controller->GetEndHandleRect();
if (handle_start.IsEmpty()) {
handles_in_place = true;
} else {
bool has_end_handle =
!touch_selection_controller->GetEndHandleRect().IsEmpty();
bool start_near_y =
std::abs(selection_start.y() - handle_start.y()) <= 3.f;
bool start_in_x_range = selection_start.x() >= handle_start.x() &&
selection_start.x() <= handle_start.right();
bool end_near_y = std::abs(selection_end.y() - handle_end.y()) <= 3.f;
bool end_in_x_range = selection_end.x() >= handle_end.x() &&
selection_end.x() <= handle_end.right();
handles_in_place = start_near_y && start_in_x_range && end_near_y &&
end_in_x_range && has_end_handle;
}
if (!handles_in_place)
DelayBy(base::Milliseconds(100));
}
}
RenderWidgetHostViewAndroid* root_rwhv() { return root_rwhv_; }
RenderWidgetHostViewChildFrame* child_rwhv() { return child_rwhv_; }
float PageScaleFactor() {
return frame_observer_->LastRenderFrameMetadata().page_scale_factor;
}
TouchSelectionControllerClientTestWrapper* selection_controller_client() {
return selection_controller_client_;
}
void OnSyntheticGestureSent() {
gesture_run_loop_ = std::make_unique<base::RunLoop>();
gesture_run_loop_->Run();
}
void OnSyntheticGestureCompleted(SyntheticGesture::Result result) {
EXPECT_EQ(SyntheticGesture::GESTURE_FINISHED, result);
gesture_run_loop_->Quit();
}
protected:
void DelayBy(base::TimeDelta delta) {
base::RunLoop run_loop;
base::SingleThreadTaskRunner::GetCurrentDefault()->PostDelayedTask(
FROM_HERE, run_loop.QuitClosure(), delta);
run_loop.Run();
}
private:
void SendTouch(RenderWidgetHostViewAndroid* view,
ui::MotionEvent::Action action,
gfx::Point point) {
DCHECK(action >= ui::MotionEvent::Action::DOWN &&
action < ui::MotionEvent::Action::CANCEL);
ui::MotionEventAndroid::Pointer p(0, point.x(), point.y(), 10, 0, 0, 0, 0);
JNIEnv* env = base::android::AttachCurrentThread();
auto time_ns = (ui::EventTimeForNow() - base::TimeTicks()).InNanoseconds();
ui::MotionEventAndroid touch(
env, nullptr, 1.f, 0, 0, 0, base::TimeTicks::FromJavaNanoTime(time_ns),
ui::MotionEventAndroid::GetAndroidAction(action), 1, 0, 0, 0, 0, 0, 0,
0, 0, false, &p, nullptr);
view->OnTouchEvent(touch);
}
raw_ptr<RenderWidgetHostViewAndroid, DanglingUntriaged> root_rwhv_;
raw_ptr<RenderWidgetHostViewChildFrame, DanglingUntriaged> child_rwhv_;
raw_ptr<FrameTreeNode, DanglingUntriaged> child_frame_tree_node_;
std::unique_ptr<RenderFrameSubmissionObserver> frame_observer_;
raw_ptr<TouchSelectionControllerClientTestWrapper, DanglingUntriaged>
selection_controller_client_;
std::unique_ptr<base::RunLoop> gesture_run_loop_;
};
IN_PROC_BROWSER_TEST_P(TouchSelectionControllerClientAndroidSiteIsolationTest,
BasicSelectionIsolatedIframe) {
SetupTest();
EXPECT_EQ(ui::TouchSelectionController::INACTIVE,
root_rwhv()->touch_selection_controller()->active_status());
gfx::PointF point_f = GetPointInChild();
selection_controller_client()->InitWaitForSelectionEvent(
ui::SELECTION_HANDLES_SHOWN);
SelectWithLongPress(gfx::Point(point_f.x(), point_f.y()));
selection_controller_client()->Wait();
EXPECT_EQ(ui::TouchSelectionController::SELECTION_ACTIVE,
root_rwhv()->touch_selection_controller()->active_status());
VerifyHandlePosition();
selection_controller_client()->InitWaitForSelectionEvent(
ui::SELECTION_HANDLES_CLEARED);
gfx::PointF point_inside_iframe =
child_rwhv()->TransformPointToRootCoordSpaceF(gfx::PointF(+5.f, +5.f));
SimpleTap(gfx::Point(point_inside_iframe.x(), point_inside_iframe.y()));
selection_controller_client()->Wait();
EXPECT_EQ(ui::TouchSelectionController::INACTIVE,
root_rwhv()->touch_selection_controller()->active_status());
DelayBy(base::Milliseconds(2000));
selection_controller_client()->InitWaitForSelectionEvent(
ui::SELECTION_HANDLES_SHOWN);
SelectWithLongPress(gfx::Point(point_f.x(), point_f.y()));
selection_controller_client()->Wait();
EXPECT_EQ(ui::TouchSelectionController::SELECTION_ACTIVE,
root_rwhv()->touch_selection_controller()->active_status());
selection_controller_client()->InitWaitForSelectionEvent(
ui::SELECTION_HANDLES_CLEARED);
gfx::PointF point_outside_iframe =
child_rwhv()->TransformPointToRootCoordSpaceF(gfx::PointF(-5.f, -5.f));
SimpleTap(gfx::Point(point_outside_iframe.x(), point_outside_iframe.y()));
selection_controller_client()->Wait();
EXPECT_EQ(ui::TouchSelectionController::INACTIVE,
root_rwhv()->touch_selection_controller()->active_status());
ShutdownTest();
}
#if BUILDFLAG(IS_ANDROID)
#define MAYBE_SelectionThenPinchInOOPIF …
#else
#define MAYBE_SelectionThenPinchInOOPIF …
#endif
IN_PROC_BROWSER_TEST_P(TouchSelectionControllerClientAndroidSiteIsolationTest,
MAYBE_SelectionThenPinchInOOPIF) {
SetupTest();
EXPECT_EQ(ui::TouchSelectionController::INACTIVE,
root_rwhv()->touch_selection_controller()->active_status());
gfx::PointF point_f = GetPointInChild();
selection_controller_client()->InitWaitForSelectionEvent(
ui::SELECTION_HANDLES_SHOWN);
SelectWithLongPress(gfx::Point(point_f.x(), point_f.y()));
selection_controller_client()->Wait();
EXPECT_EQ(ui::TouchSelectionController::SELECTION_ACTIVE,
root_rwhv()->touch_selection_controller()->active_status());
VerifyHandlePosition();
float page_scale_delta = 2.f;
float current_page_scale = PageScaleFactor();
float target_page_scale = current_page_scale * page_scale_delta;
SyntheticPinchGestureParams params;
params.anchor = point_f;
params.scale_factor = page_scale_delta;
auto synthetic_pinch_gesture =
std::make_unique<SyntheticTouchscreenPinchGesture>(params);
auto* host =
static_cast<RenderWidgetHostImpl*>(root_rwhv()->GetRenderWidgetHost());
InputEventAckWaiter gesture_pinch_end_waiter(
host, blink::WebInputEvent::Type::kGesturePinchEnd);
host->QueueSyntheticGesture(
std::move(synthetic_pinch_gesture),
base::BindOnce(&TouchSelectionControllerClientAndroidSiteIsolationTest::
OnSyntheticGestureCompleted,
base::Unretained(this)));
OnSyntheticGestureSent();
gesture_pinch_end_waiter.Wait();
VerifyHandlePosition();
const float kScaleFactorTolerance = 0.05f;
EXPECT_NEAR(target_page_scale, PageScaleFactor(), kScaleFactorTolerance);
ShutdownTest();
}
#endif
class TouchEventObserver : public RenderWidgetHost::InputEventObserver { … };
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
DISABLED_TouchEventAckQueueOrdering) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
ActiveSandboxFlagsMaintainedAcrossNavigation) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
ActiveSandboxFlagsRetainedAfterUnload) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
ActiveSandboxFlagsCorrectInProxies) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
ActiveSandboxFlagsCorrectAfterUpdate) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
ActiveSandboxFlagsCorrectWhenCleared) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
SubframeReusesExistingProcess) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
NoProcessSharingAfterSubframeReusesExistingProcess) { … }
namespace {
class CommitMessageOrderReverser : public DidCommitNavigationInterceptor { … };
}
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS_ASH)
#define MAYBE_OOPIFDetachDuringAnimation …
#else
#define MAYBE_OOPIFDetachDuringAnimation …
#endif
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
MAYBE_OOPIFDetachDuringAnimation) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
IFrameSameDocumentNavigation) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, SizeAvailableAfterCommit) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
RenderViewHostStaysActiveWithLateUnloadACK) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
SubframeVisibleAfterRenderViewBecomesSwappedOut) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, FrameDepthSimple) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, FrameDepthTest) { … }
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
#define MAYBE_VisibilityFrameDepthTest …
#else
#define MAYBE_VisibilityFrameDepthTest …
#endif
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
MAYBE_VisibilityFrameDepthTest) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
CrossProcessPostMessageWaitsForCurrentScriptToFinish) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
CrossProcessPostMessageAndDetachTarget) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
LastCommittedURLRetainedAfterUnload) { … }
#if BUILDFLAG(IS_ANDROID)
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
GestureManagerListensToChildFrames) {
GURL main_url(embedded_test_server()->GetURL(
"a.com", "/cross_site_iframe_factory.html?a(b)"));
EXPECT_TRUE(NavigateToURL(shell(), main_url));
FrameTreeNode* root = web_contents()->GetPrimaryFrameTree().root();
FrameTreeNode* child = root->child_at(0);
GURL b_url(embedded_test_server()->GetURL("b.com", "/scrollable_page.html"));
EXPECT_TRUE(NavigateToURLFromRenderer(child, b_url));
EXPECT_EQ(
" Site A ------------ proxies for B\n"
" +--Site B ------- proxies for A\n"
"Where A = http://a.com/\n"
" B = http://b.com/",
DepictFrameTree(root));
RenderWidgetHost* rwh = root->current_frame_host()->GetRenderWidgetHost();
RenderWidgetHost* child_rwh =
child->current_frame_host()->GetRenderWidgetHost();
RunUntilInputProcessed(rwh);
RunUntilInputProcessed(child_rwh);
RenderWidgetHostViewAndroid* rwhv_root =
static_cast<RenderWidgetHostViewAndroid*>(
root->current_frame_host()->GetRenderWidgetHost()->GetView());
ASSERT_FALSE(
rwhv_root->gesture_listener_manager_->IsScrollInProgressForTesting());
{
blink::WebGestureEvent gesture_scroll_begin(
blink::WebGestureEvent::Type::kGestureScrollBegin,
blink::WebInputEvent::kNoModifiers,
blink::WebInputEvent::GetStaticTimeStampForTests(),
blink::WebGestureDevice::kTouchscreen);
gesture_scroll_begin.data.scroll_begin.delta_hint_units =
ui::ScrollGranularity::kScrollByPrecisePixel;
gesture_scroll_begin.data.scroll_begin.delta_x_hint = 0.f;
gesture_scroll_begin.data.scroll_begin.delta_y_hint = -5.f;
blink::WebMouseEvent mouse_move(
blink::WebInputEvent::Type::kMouseMove,
blink::WebInputEvent::kNoModifiers,
blink::WebInputEvent::GetStaticTimeStampForTests());
InputEventAckWaiter mouse_move_waiter(
child_rwh, blink::WebInputEvent::Type::kMouseMove);
child_rwh->ForwardGestureEvent(gesture_scroll_begin);
child_rwh->ForwardMouseEvent(mouse_move);
mouse_move_waiter.Wait();
EXPECT_TRUE(
rwhv_root->gesture_listener_manager_->IsScrollInProgressForTesting());
}
{
blink::WebGestureEvent gesture_scroll_end(
blink::WebGestureEvent::Type::kGestureScrollEnd,
blink::WebInputEvent::kNoModifiers,
blink::WebInputEvent::GetStaticTimeStampForTests(),
blink::WebGestureDevice::kTouchscreen);
blink::WebMouseEvent mouse_move(
blink::WebInputEvent::Type::kMouseMove,
blink::WebInputEvent::kNoModifiers,
blink::WebInputEvent::GetStaticTimeStampForTests());
InputEventAckWaiter mouse_move_waiter(
child_rwh, blink::WebInputEvent::Type::kMouseMove);
child_rwh->ForwardGestureEvent(gesture_scroll_end);
child_rwh->ForwardMouseEvent(mouse_move);
mouse_move_waiter.Wait();
EXPECT_FALSE(
rwhv_root->gesture_listener_manager_->IsScrollInProgressForTesting());
}
}
#endif
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, DisplayLockThrottlesOOPIF) { … }
namespace {
class ClosePageBeforeCommitHelper : public DidCommitNavigationInterceptor { … };
}
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
CloseTabBeforeSubframeCommits) { … }
class SitePerProcessBrowserTouchActionTest : public SitePerProcessBrowserTest { … };
#if BUILDFLAG(IS_ANDROID)
class EnableForceZoomContentClient
: public ContentBrowserTestContentBrowserClient {
public:
EnableForceZoomContentClient() = default;
EnableForceZoomContentClient(const EnableForceZoomContentClient&) = delete;
EnableForceZoomContentClient& operator=(const EnableForceZoomContentClient&) =
delete;
void OverrideWebkitPrefs(WebContents* web_contents,
blink::web_pref::WebPreferences* prefs) override {
prefs->force_enable_zoom = true;
}
};
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTouchActionTest,
ForceEnableZoomPropagatesToChild) {
GURL main_url(embedded_test_server()->GetURL(
"a.com", "/cross_site_iframe_factory.html?a(b)"));
EXPECT_TRUE(NavigateToURL(shell(), main_url));
FrameTreeNode* root = web_contents()->GetPrimaryFrameTree().root();
ASSERT_EQ(1U, root->child_count());
GURL b_url(embedded_test_server()->GetURL("b.com", "/title1.html"));
FrameTreeNode* child = root->child_at(0);
EXPECT_TRUE(NavigateToURLFromRenderer(child, b_url));
WaitForHitTestData(child->current_frame_host());
RenderWidgetHost* child_rwh =
child->current_frame_host()->GetRenderWidgetHost();
EXPECT_FALSE(GetTouchActionForceEnableZoom(child_rwh));
EnableForceZoomContentClient new_client;
web_contents()->OnWebPreferencesChanged();
EXPECT_TRUE(GetTouchActionForceEnableZoom(child_rwh));
GURL c_url = embedded_test_server()->GetURL("c.com", "/title1.html");
std::string create_frame_script = base::StringPrintf(
"var new_iframe = document.createElement('iframe');"
"new_iframe.src = '%s';"
"document.body.appendChild(new_iframe);",
c_url.spec().c_str());
EXPECT_TRUE(ExecJs(root, create_frame_script));
EXPECT_TRUE(WaitForLoadStop(web_contents()));
ASSERT_EQ(2U, root->child_count());
FrameTreeNode* new_child = root->child_at(1);
EXPECT_NE(root->current_frame_host()->GetRenderWidgetHost(),
new_child->current_frame_host()->GetRenderWidgetHost());
EXPECT_TRUE(GetTouchActionForceEnableZoom(
new_child->current_frame_host()->GetRenderWidgetHost()));
}
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTouchActionTest,
CheckForceEnableZoomValue) {
EXPECT_TRUE(NavigateToURL(
shell(), embedded_test_server()->GetURL("foo.com", "/title1.html")));
EXPECT_FALSE(GetTouchActionForceEnableZoom(
web_contents()->GetPrimaryMainFrame()->GetRenderViewHost()->GetWidget()));
EnableForceZoomContentClient new_client;
web_contents()->OnWebPreferencesChanged();
EXPECT_TRUE(GetTouchActionForceEnableZoom(
web_contents()->GetPrimaryMainFrame()->GetRenderViewHost()->GetWidget()));
EXPECT_TRUE(NavigateToURL(
shell(), embedded_test_server()->GetURL("bar.com", "/title2.html")));
EXPECT_TRUE(GetTouchActionForceEnableZoom(
web_contents()->GetPrimaryMainFrame()->GetRenderViewHost()->GetWidget()));
}
#endif
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTouchActionTest,
DISABLED_EffectiveTouchActionPropagatesAcrossFrames) { … }
IN_PROC_BROWSER_TEST_F(
SitePerProcessBrowserTouchActionTest,
DISABLED_EffectiveTouchActionPropagatesAcrossNestedFrames) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTouchActionTest,
EffectiveTouchActionPropagatesWhenChildFrameNavigates) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
ChildFrameCrashMetrics_KilledMainFrame) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
ChildFrameCrashMetrics_NeverShown) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
ChildFrameCrashMetrics_ScrolledIntoView) { … }
class SitePerProcessAndProcessPerSiteBrowserTest
: public SitePerProcessBrowserTest { … };
IN_PROC_BROWSER_TEST_P(SitePerProcessAndProcessPerSiteBrowserTest,
GeneratedTransitionsSwapProcesses) { … }
namespace {
class SameDocumentCommitObserver : public WebContentsObserver { … };
}
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
ReplaceStateDoesNotCancelCrossSiteNavigation) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
SameDocumentNavigationDoesNotCommitPendingFramePolicy) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
TwoBlobURLsWithNullOriginDontShareProcess) { … }
#if BUILDFLAG(IS_FUCHSIA)
#define MAYBE_RenderFrameProxyNotRecreatedDuringProcessShutdown …
#else
#define MAYBE_RenderFrameProxyNotRecreatedDuringProcessShutdown …
#endif
IN_PROC_BROWSER_TEST_P(
SitePerProcessBrowserTest,
MAYBE_RenderFrameProxyNotRecreatedDuringProcessShutdown) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
CommitTimeoutForHungRenderer) { … }
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_LACROS)
#define MAYBE_NoCommitTimeoutForInvisibleWebContents …
#else
#define MAYBE_NoCommitTimeoutForInvisibleWebContents …
#endif
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
MAYBE_NoCommitTimeoutForInvisibleWebContents) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, ProcessSwapOnInnerContents) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, FocusInnerContentsFromOOPIF) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
FileURLBlockedWithConsoleErrorInRemoteFrameNavigation) { … }
#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_ANDROID)
class DoubleTapZoomContentBrowserClient
: public ContentBrowserTestContentBrowserClient {
public:
DoubleTapZoomContentBrowserClient() = default;
DoubleTapZoomContentBrowserClient(const DoubleTapZoomContentBrowserClient&) =
delete;
DoubleTapZoomContentBrowserClient& operator=(
const DoubleTapZoomContentBrowserClient&) = delete;
void OverrideWebkitPrefs(
content::WebContents* web_contents,
blink::web_pref::WebPreferences* web_prefs) override {
web_prefs->double_tap_to_zoom_enabled = true;
}
};
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
TouchscreenAnimateDoubleTapZoomInOOPIF) {
DoubleTapZoomContentBrowserClient content_browser_client;
web_contents()->OnWebPreferencesChanged();
GURL main_url(embedded_test_server()->GetURL(
"a.com", "/cross_site_iframe_factory.html?a(b)"));
EXPECT_TRUE(NavigateToURL(shell(), main_url));
FrameTreeNode* root = web_contents()->GetPrimaryFrameTree().root();
ASSERT_EQ(1u, root->child_count());
FrameTreeNode* child_b = root->child_at(0);
ASSERT_TRUE(child_b);
RenderFrameSubmissionObserver observer_a(root);
observer_a.WaitForAnyFrameSubmission();
float original_page_scale =
observer_a.LastRenderFrameMetadata().page_scale_factor;
WaitForHitTestData(child_b->current_frame_host());
gfx::PointF tap_position =
child_b->current_frame_host()
->GetRenderWidgetHost()
->GetView()
->TransformPointToRootCoordSpaceF(gfx::PointF(10, 10));
static constexpr char kActionsTemplate[] = R"HTML(
[{
"source" : "touch",
"actions" : [
{ "name": "pointerDown", "x": %f, "y": %f},
{ "name": "pointerUp"},
{ "name": "pause", "duration": 50 },
{ "name": "pointerDown", "x": %f, "y": %f},
{ "name": "pointerUp"}
]
}]
)HTML";
std::string double_tap_actions_json =
base::StringPrintf(kActionsTemplate, tap_position.x(), tap_position.y(),
tap_position.x(), tap_position.y());
auto parsed_json =
base::JSONReader::ReadAndReturnValueWithError(double_tap_actions_json);
ASSERT_TRUE(parsed_json.has_value()) << parsed_json.error().message;
ActionsParser actions_parser(std::move(*parsed_json));
ASSERT_TRUE(actions_parser.Parse());
auto synthetic_gesture_doubletap = std::make_unique<SyntheticPointerAction>(
actions_parser.pointer_action_params());
InputEventAckWaiter ack_waiter(
child_b->current_frame_host()->GetRenderWidgetHost(),
blink::WebInputEvent::Type::kGestureDoubleTap);
auto* host = static_cast<RenderWidgetHostImpl*>(
root->current_frame_host()->GetRenderWidgetHost());
host->QueueSyntheticGesture(
std::move(synthetic_gesture_doubletap),
base::BindOnce([](SyntheticGesture::Result result) {
EXPECT_EQ(SyntheticGesture::GESTURE_FINISHED, result);
}));
ack_waiter.Wait();
float target_scale = 1.1f * original_page_scale;
float new_page_scale = original_page_scale;
do {
observer_a.WaitForAnyFrameSubmission();
new_page_scale = observer_a.LastRenderFrameMetadata().page_scale_factor;
} while (new_page_scale < target_scale);
}
#endif
class CrossProcessNavigationObjectElementTest
: public SitePerProcessBrowserTestBase,
public testing::WithParamInterface<
std::tuple<std::string, std::string, std::string>> { … };
IN_PROC_BROWSER_TEST_P(CrossProcessNavigationObjectElementTest, FallbackShown) { … }
INSTANTIATE_TEST_SUITE_P(…);
#if !BUILDFLAG(IS_ANDROID)
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
DISABLED_OccludedRenderWidgetThrottlesRAF) { … }
#endif
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
CommittedOriginIncompatibleWithOriginLock) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
PluginElementResponsiveInCrossProcessNavigations) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
NavigationCommitInIframePendingDeletionAB) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
NavigationCommitInIframePendingDeletionABC) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
SameDocumentCommitWhilePendingDeletion) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
HistoryNavigationWhilePendingDeletion) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
OpenUrlToRemoteFramePendingDeletion) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
ProcessDiesBeforeCrossSiteNavigationCompletes) { … }
enum class InnerWebContentsAttachChildFrameOriginType { … };
class InnerWebContentsAttachTest
: public SitePerProcessBrowserTestBase,
public testing::WithParamInterface<
std::tuple<InnerWebContentsAttachChildFrameOriginType,
bool ,
bool >> { … };
IN_PROC_BROWSER_TEST_P(InnerWebContentsAttachTest, PrepareFrame) { … }
INSTANTIATE_TEST_SUITE_P(…);
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
SameAndCrossProcessIframeAboutBlankNavigation) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest,
AccessWindowProxyOfCrashedFrameAfterNavigation) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, CloseNoopenerWindow) { … }
IN_PROC_BROWSER_TEST_P(
SitePerProcessBrowserTest,
ProcessNotReusedAfterInitialNavigationToRendererDebugURL) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, UserActivationCrossSite) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, UserActivationSameSite) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, UserActivationSameOrigin) { … }
class DisableProcessReusePolicyTest : public SitePerProcessBrowserTest { … };
IN_PROC_BROWSER_TEST_P(DisableProcessReusePolicyTest,
DisableProcessReusePolicy) { … }
class SitePerProcessWithMainFrameThresholdTestBase
: public SitePerProcessBrowserTestBase { … };
class SitePerProcessWithMainFrameThresholdTest
: public SitePerProcessWithMainFrameThresholdTestBase,
public ::testing::WithParamInterface<std::string> { … };
IN_PROC_BROWSER_TEST_P(SitePerProcessWithMainFrameThresholdTest,
ReuseProcessUpToThreshold) { … }
class SitePerProcessWithMainFrameThresholdWithTotalLimitTest
: public SitePerProcessWithMainFrameThresholdTestBase,
public ::testing::WithParamInterface<std::string> { … };
class RendererHostInterceptor
: public mojom::RendererHostInterceptorForTesting { … };
IN_PROC_BROWSER_TEST_P(SitePerProcessWithMainFrameThresholdWithTotalLimitTest,
ExcessiveAllocation) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessWithMainFrameThresholdWithTotalLimitTest,
AllowedAllocation) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessWithMainFrameThresholdTest,
ReuseProcessOpenTabByCtrlClickLink) { … }
IN_PROC_BROWSER_TEST_P(SitePerProcessWithMainFrameThresholdTest,
ReuseProcessWithOpener) { … }
class SitePerProcessWithMainFrameThresholdLocalhostTest
: public SitePerProcessWithMainFrameThresholdTestBase,
public ::testing::WithParamInterface<bool> { … };
IN_PROC_BROWSER_TEST_P(SitePerProcessWithMainFrameThresholdLocalhostTest,
AllowReuseLocalHost) { … }
class SitePerProcessWithMainFrameThresholdDevToolsTest
: public SitePerProcessWithMainFrameThresholdTestBase,
public TestDevToolsProtocolClient { … };
IN_PROC_BROWSER_TEST_F(SitePerProcessWithMainFrameThresholdDevToolsTest,
DevToolsAttached) { … }
INSTANTIATE_TEST_SUITE_P(…);
#if BUILDFLAG(IS_ANDROID)
INSTANTIATE_TEST_SUITE_P(All,
SitePerProcessAndroidImeTest,
testing::ValuesIn(RenderDocumentFeatureLevelValues()));
#endif
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
#if BUILDFLAG(IS_ANDROID)
INSTANTIATE_TEST_SUITE_P(All,
TouchSelectionControllerClientAndroidSiteIsolationTest,
testing::ValuesIn(RenderDocumentFeatureLevelValues()));
#endif
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
}