Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(792)

Unified Diff: content/browser/frame_host/navigator_impl_unittest.cc

Issue 2707263013: Don't recreate feature policy on fragment navigation (Closed)
Patch Set: Simplify test navigation Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/frame_host/navigator_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/navigator_impl_unittest.cc
diff --git a/content/browser/frame_host/navigator_impl_unittest.cc b/content/browser/frame_host/navigator_impl_unittest.cc
index 41e14e775ffd63d641a036e32533a52bbf52bce8..c5b35f16ce706452abdb2928caa2cb28a3a951bc 100644
--- a/content/browser/frame_host/navigator_impl_unittest.cc
+++ b/content/browser/frame_host/navigator_impl_unittest.cc
@@ -1240,4 +1240,49 @@ TEST_F(NavigatorTestWithBrowserSideNavigation,
EXPECT_EQ(speculative_rfh, main_test_rfh());
}
+// Feature Policy: Test that the feature policy is reset when navigating pages
+// within a site.
+TEST_F(NavigatorTestWithBrowserSideNavigation,
+ FeaturePolicySameSiteNavigation) {
+ const GURL kUrl1("http://www.chromium.org/");
+ const GURL kUrl2("http://www.chromium.org/Home");
+
+ contents()->NavigateAndCommit(kUrl1);
+
+ // Check the feature policy before navigation.
+ FeaturePolicy* original_feature_policy =
+ main_test_rfh()->get_feature_policy();
+ ASSERT_TRUE(original_feature_policy);
+
+ // Navigate to the new URL.
+ contents()->NavigateAndCommit(kUrl2);
+
+ // Check the feature policy after navigation.
+ FeaturePolicy* final_feature_policy = main_test_rfh()->get_feature_policy();
+ ASSERT_TRUE(final_feature_policy);
+ ASSERT_NE(original_feature_policy, final_feature_policy);
+}
+
+// Feature Policy: Test that the feature policy is not reset when navigating
+// within a page.
+TEST_F(NavigatorTestWithBrowserSideNavigation,
+ FeaturePolicyFragmentNavigation) {
+ const GURL kUrl1("http://www.chromium.org/");
+ const GURL kUrl2("http://www.chromium.org/#Home");
+
+ contents()->NavigateAndCommit(kUrl1);
+
+ // Check the feature policy before navigation.
+ FeaturePolicy* original_feature_policy =
+ main_test_rfh()->get_feature_policy();
+ ASSERT_TRUE(original_feature_policy);
+
+ // Navigate to the new URL.
+ contents()->NavigateAndCommit(kUrl2);
+
+ // Check the feature policy after navigation.
+ FeaturePolicy* final_feature_policy = main_test_rfh()->get_feature_policy();
+ ASSERT_EQ(original_feature_policy, final_feature_policy);
+}
+
} // namespace content
« no previous file with comments | « content/browser/frame_host/navigator_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698