#include "content/browser/site_instance_impl.h"
#include <stddef.h>
#include <memory>
#include <string>
#include <vector>
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/test/mock_log.h"
#include "base/test/scoped_command_line.h"
#include "base/test/scoped_feature_list.h"
#include "content/browser/browsing_instance.h"
#include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/isolated_origin_util.h"
#include "content/browser/origin_agent_cluster_isolation_state.h"
#include "content/browser/process_lock.h"
#include "content/browser/renderer_host/navigation_entry_impl.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/site_info.h"
#include "content/browser/url_info.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/browser/web_exposed_isolation_info.h"
#include "content/browser/webui/url_data_manager_backend.h"
#include "content/browser/webui/web_ui_controller_factory_registry.h"
#include "content/public/browser/browser_or_resource_context.h"
#include "content/public/browser/site_isolation_policy.h"
#include "content/public/browser/web_exposed_isolation_level.h"
#include "content/public/browser/web_ui_controller.h"
#include "content/public/common/bindings_policy.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_constants.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/common/url_utils.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/mock_render_process_host.h"
#include "content/public/test/scoped_web_ui_controller_factory_registration.h"
#include "content/public/test/test_browser_context.h"
#include "content/public/test/test_utils.h"
#include "content/test/storage_partition_test_helpers.h"
#include "content/test/test_content_browser_client.h"
#include "content/test/test_content_client.h"
#include "content/test/test_render_view_host.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/origin.h"
#include "url/url_util.h"
namespace content {
namespace {
IsolatedOriginSource;
bool DoesURLRequireDedicatedProcess(const IsolationContext& isolation_context,
const GURL& url) { … }
SiteInfo CreateSimpleSiteInfo(const GURL& process_lock_url,
bool requires_origin_keyed_process) { … }
}
const char kPrivilegedScheme[] = …;
const char kCustomStandardScheme[] = …;
class SiteInstanceTestBrowserClient : public TestContentBrowserClient { … };
class SiteInstanceTest : public testing::Test { … };
TEST_F(SiteInstanceTest, SiteInfoAsContainerKey) { … }
TEST_F(SiteInstanceTest, SiteInstanceDestructor) { … }
TEST_F(SiteInstanceTest,
OriginKeyedProcessesByDefault_SiteInfo_CreateForTesting) { … }
TEST_F(SiteInstanceTest, DefaultSiteInstanceProperties) { … }
TEST_F(SiteInstanceTest, DefaultSiteInstanceDestruction) { … }
TEST_F(SiteInstanceTest, GetProcess) { … }
TEST_F(SiteInstanceTest, SetSite) { … }
TEST_F(SiteInstanceTest, GetSiteForURL) { … }
TEST_F(SiteInstanceTest, ProcessLockDoesNotUseEffectiveURL) { … }
TEST_F(SiteInstanceTest, IsSameSite) { … }
TEST_F(SiteInstanceTest, IsSameSiteForFileURLs) { … }
TEST_F(SiteInstanceTest, OneSiteInstancePerSite) { … }
TEST_F(SiteInstanceTest, OneSiteInstancePerSiteInBrowserContext) { … }
TEST_F(SiteInstanceTest, IsSuitableForUrlInfo) { … }
TEST_F(SiteInstanceTest, IsSuitableForUrlInfoInSitePerProcess) { … }
TEST_F(SiteInstanceTest, ProcessPerSiteWithWrongBindings) { … }
TEST_F(SiteInstanceTest, NoProcessPerSiteForEmptySite) { … }
TEST_F(SiteInstanceTest, IsSameSiteForNestedURLs) { … }
TEST_F(SiteInstanceTest, StrictOriginIsolation) { … }
TEST_F(SiteInstanceTest, IsolatedOrigins) { … }
TEST_F(SiteInstanceTest, IsolatedOriginsWithPort) { … }
TEST_F(SiteInstanceTest, IsValidIsolatedOrigin) { … }
TEST_F(SiteInstanceTest, SubdomainOnIsolatedSite) { … }
TEST_F(SiteInstanceTest, SubdomainOnIsolatedOrigin) { … }
TEST_F(SiteInstanceTest, MultipleIsolatedOriginsWithCommonSite) { … }
TEST_F(SiteInstanceTest, OriginalURL) { … }
TEST_F(SiteInstanceTest, WebExposedIsolationLevel) { … }
namespace {
ProcessLock ProcessLockFromString(const std::string& url) { … }
}
TEST_F(SiteInstanceTest, IsProcessLockASite) { … }
TEST_F(SiteInstanceTest, StartIsolatingSite) { … }
TEST_F(SiteInstanceTest, CreateForUrlInfo) { … }
TEST_F(SiteInstanceTest, CreateForGuest) { … }
TEST_F(SiteInstanceTest, DoesSiteRequireDedicatedProcess) { … }
TEST_F(SiteInstanceTest, DoWebUIURLsWithSubdomainsUseTLDForProcessLock) { … }
TEST_F(SiteInstanceTest, ErrorPage) { … }
TEST_F(SiteInstanceTest, RelatedSitesInheritStoragePartitionConfig) { … }
TEST_F(SiteInstanceTest, GetNonOriginKeyedEquivalentPreservesIsPdf) { … }
TEST_F(SiteInstanceTest, SiteInfoDetermineProcessLock_OriginAgentCluster) { … }
TEST_F(SiteInstanceTest, ShouldAssignSiteForAboutBlank) { … }
TEST_F(SiteInstanceTest, CoopRelatedSiteInstanceIdentity) { … }
TEST_F(SiteInstanceTest, CoopRelatedSiteInstanceCrossSite) { … }
TEST_F(SiteInstanceTest, CoopRelatedSiteInstanceIdenticalCoopOriginSameSite) { … }
TEST_F(SiteInstanceTest, CoopRelatedSiteInstanceIdenticalCoopOriginCrossSite) { … }
TEST_F(SiteInstanceTest, CoopRelatedSiteInstanceDifferentCoopOrigin) { … }
TEST_F(SiteInstanceTest, CoopRelatedSiteInstanceIdenticalCrossOriginIsolation) { … }
TEST_F(SiteInstanceTest, CoopRelatedSiteInstanceDifferentCrossOriginIsolation) { … }
TEST_F(SiteInstanceTest, GroupTokensBuilding) { … }
TEST_F(SiteInstanceTest, GroupTokensRelatedSiteInstances) { … }
TEST_F(SiteInstanceTest, GroupTokensCoopRelatedSiteInstances) { … }
TEST_F(SiteInstanceTest, GroupTokensUnrelatedSiteInstances) { … }
namespace {
class SiteInstanceGotProcessAndSiteBrowserClient
: public TestContentBrowserClient { … };
}
TEST_F(SiteInstanceTest, SiteInstanceGotProcessAndSite_ProcessThenSite) { … }
TEST_F(SiteInstanceTest, SiteInstanceGotProcessAndSite_SiteThenProcess) { … }
TEST_F(SiteInstanceTest, SiteInstanceGotProcessAndSite_ProcessPerSite) { … }
}