summaryrefslogtreecommitdiff
path: root/chromium/content/browser/isolated_origin_browsertest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/content/browser/isolated_origin_browsertest.cc')
-rw-r--r--chromium/content/browser/isolated_origin_browsertest.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/chromium/content/browser/isolated_origin_browsertest.cc b/chromium/content/browser/isolated_origin_browsertest.cc
index d441653ac6b..cef4700c066 100644
--- a/chromium/content/browser/isolated_origin_browsertest.cc
+++ b/chromium/content/browser/isolated_origin_browsertest.cc
@@ -3,12 +3,15 @@
// found in the LICENSE file.
#include "base/command_line.h"
+#include "base/macros.h"
+#include "base/test/scoped_feature_list.h"
#include "content/browser/bad_message.h"
#include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/storage_partition_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/browser_side_navigation_policy.h"
+#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test.h"
@@ -55,6 +58,9 @@ class IsolatedOriginTest : public ContentBrowserTest {
"document.body.appendChild(link);"
"link.click();"));
}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(IsolatedOriginTest);
};
// Check that navigating a main frame from an non-isolated origin to an
@@ -896,6 +902,8 @@ class StoragePartitonInterceptor
// Keep a pointer to the original implementation of the service, so all
// calls can be forwarded to it.
mojom::StoragePartitionService* storage_partition_service_;
+
+ DISALLOW_COPY_AND_ASSIGN(StoragePartitonInterceptor);
};
void CreateTestStoragePartitionService(
@@ -929,4 +937,28 @@ IN_PROC_BROWSER_TEST_F(IsolatedOriginTest, LocalStorageOriginEnforcement) {
crash_observer.Wait();
}
+class IsolatedOriginFieldTrialTest : public ContentBrowserTest {
+ public:
+ IsolatedOriginFieldTrialTest() {
+ scoped_feature_list_.InitAndEnableFeatureWithParameters(
+ features::kIsolateOrigins,
+ {{features::kIsolateOriginsFieldTrialParamName,
+ "https://field.trial.com/,https://bar.com/"}});
+ }
+ ~IsolatedOriginFieldTrialTest() override {}
+
+ private:
+ base::test::ScopedFeatureList scoped_feature_list_;
+
+ DISALLOW_COPY_AND_ASSIGN(IsolatedOriginFieldTrialTest);
+};
+
+IN_PROC_BROWSER_TEST_F(IsolatedOriginFieldTrialTest, Test) {
+ auto* policy = ChildProcessSecurityPolicyImpl::GetInstance();
+ EXPECT_TRUE(policy->IsIsolatedOrigin(
+ url::Origin::Create(GURL("https://field.trial.com/"))));
+ EXPECT_TRUE(
+ policy->IsIsolatedOrigin(url::Origin::Create(GURL("https://bar.com/"))));
+}
+
} // namespace content