#include <set>
#include <string>
#include <string_view>
#include "base/containers/contains.h"
#include "base/files/file_path.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/ranges/algorithm.h"
#include "base/synchronization/waitable_event.h"
#include "base/test/bind.h"
#include "base/test/gtest_util.h"
#include "base/test/mock_log.h"
#include "base/test/scoped_command_line.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.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/site_info.h"
#include "content/browser/site_instance_impl.h"
#include "content/common/content_navigation_policy.h"
#include "content/common/features.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/site_isolation_policy.h"
#include "content/public/common/bindings_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/browser_task_environment.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 "storage/browser/file_system/file_permission_policy.h"
#include "storage/browser/file_system/file_system_url.h"
#include "storage/browser/file_system/isolated_context.h"
#include "storage/common/file_system/file_system_types.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace content {
namespace {
IsolatedOriginSource;
const int kRendererID = …;
#if defined(FILE_PATH_USES_DRIVE_LETTERS)
#define TEST_PATH …
#else
#define TEST_PATH(x) …
#endif
class ChildProcessSecurityPolicyTestBrowserClient
: public TestContentBrowserClient { … };
bool IsCitadelProtectionEnabled() { … }
void LockProcessIfNeeded(int process_id,
BrowserContext* browser_context,
const GURL& url) { … }
}
enum class ChildProcessSecurityPolicyTestCase { … };
class ChildProcessSecurityPolicyTest
: public testing::Test,
public ::testing::WithParamInterface<ChildProcessSecurityPolicyTestCase> { … };
class ChildProcessSecurityPolicyTest_NoOriginKeyedProcessesByDefault
: public ChildProcessSecurityPolicyTest { … };
TEST_P(ChildProcessSecurityPolicyTest, ChildID) { … }
TEST_P(ChildProcessSecurityPolicyTest, IsWebSafeSchemeTest) { … }
TEST_P(ChildProcessSecurityPolicyTest, IsPseudoSchemeTest) { … }
TEST_P(ChildProcessSecurityPolicyTest, StandardSchemesTest) { … }
TEST_P(ChildProcessSecurityPolicyTest, BlobSchemeTest) { … }
TEST_P(ChildProcessSecurityPolicyTest, AboutTest) { … }
TEST_P(ChildProcessSecurityPolicyTest, JavaScriptTest) { … }
TEST_P(ChildProcessSecurityPolicyTest, RegisterWebSafeSchemeTest) { … }
TEST_P(ChildProcessSecurityPolicyTest, CanServiceCommandsTest) { … }
TEST_P(ChildProcessSecurityPolicyTest, ViewSource) { … }
TEST_P(ChildProcessSecurityPolicyTest, GoogleChromeScheme) { … }
TEST_P(ChildProcessSecurityPolicyTest, GrantCommitURLToNonStandardScheme) { … }
TEST_P(ChildProcessSecurityPolicyTest, SpecificFile) { … }
TEST_P(ChildProcessSecurityPolicyTest, FileSystemGrantsTest) { … }
TEST_P(ChildProcessSecurityPolicyTest, FilePermissionGrantingAndRevoking) { … }
TEST_P(ChildProcessSecurityPolicyTest, FilePermissions) { … }
TEST_P(ChildProcessSecurityPolicyTest, CanServiceWebUIBindings) { … }
TEST_P(ChildProcessSecurityPolicyTest, RemoveRace) { … }
TEST_P(ChildProcessSecurityPolicyTest, RemoveRace_CanAccessDataForOrigin) { … }
TEST_P(ChildProcessSecurityPolicyTest, HandleExtendsSecurityStateLifetime) { … }
TEST_P(ChildProcessSecurityPolicyTest, HandleDuplicate) { … }
TEST_P(ChildProcessSecurityPolicyTest, CanAccessDataForOrigin_URL) { … }
TEST_P(ChildProcessSecurityPolicyTest, CanAccessDataForOrigin_Origin) { … }
TEST_P(ChildProcessSecurityPolicyTest, SandboxedProcessEnforcements) { … }
TEST_P(ChildProcessSecurityPolicyTest, PdfProcessEnforcements) { … }
TEST_P(ChildProcessSecurityPolicyTest, OriginGranting) { … }
#define LOCKED_EXPECT_THAT(lock, value, matcher) …
TEST_P(ChildProcessSecurityPolicyTest, AddFutureIsolatedOrigins) { … }
TEST_P(ChildProcessSecurityPolicyTest, IsolateAllSuborigins) { … }
TEST_P(ChildProcessSecurityPolicyTest_NoOriginKeyedProcessesByDefault,
WildcardAndNonWildcardOrigins) { … }
TEST_P(ChildProcessSecurityPolicyTest_NoOriginKeyedProcessesByDefault,
WildcardAndNonWildcardEmbedded) { … }
TEST_P(ChildProcessSecurityPolicyTest, DynamicIsolatedOrigins) { … }
TEST_P(ChildProcessSecurityPolicyTest, IsIsolatedOriginWithEmptyHost) { … }
TEST_P(ChildProcessSecurityPolicyTest,
IsolatedOriginsForSpecificBrowserContexts) { … }
TEST_P(ChildProcessSecurityPolicyTest,
IsolatedOriginsRemovedWhenBrowserContextDestroyed) { … }
TEST_P(ChildProcessSecurityPolicyTest, IsolatedOriginPattern) { … }
TEST_P(ChildProcessSecurityPolicyTest, GetIsolatedOrigins) { … }
TEST_P(ChildProcessSecurityPolicyTest, GetIsolatedOriginsWithProfile) { … }
TEST_P(ChildProcessSecurityPolicyTest, IsolatedOriginPatternEquality) { … }
TEST_P(ChildProcessSecurityPolicyTest, ParseIsolatedOrigins) { … }
TEST_P(ChildProcessSecurityPolicyTest, WildcardDefaultPort) { … }
TEST_P(ChildProcessSecurityPolicyTest, ProcessLockMatching) { … }
TEST_P(ChildProcessSecurityPolicyTest,
IsolatedOriginsForSpecificBrowsingInstances) { … }
TEST_P(ChildProcessSecurityPolicyTest,
IsolatedOriginsForCurrentAndFutureBrowsingInstances) { … }
TEST_P(ChildProcessSecurityPolicyTest, NoBrowsingInstanceIDs_OriginKeyed) { … }
TEST_P(ChildProcessSecurityPolicyTest_NoOriginKeyedProcessesByDefault,
NoBrowsingInstanceIDs_SiteKeyed) { … }
TEST_P(ChildProcessSecurityPolicyTest, NoBrowsingInstanceIDs_UnlockedProcess) { … }
TEST_P(ChildProcessSecurityPolicyTest, CannotLockUsedProcessToSite) { … }
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
}