Chromium Code Reviews| 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..fade6a9f7b082e6f6937a546a1da25a465e65737 100644 |
| --- a/content/browser/frame_host/navigator_impl_unittest.cc |
| +++ b/content/browser/frame_host/navigator_impl_unittest.cc |
| @@ -1240,4 +1240,53 @@ 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. |
| + process()->sink().ClearMessages(); |
| + main_test_rfh()->SendRendererInitiatedNavigationRequest(kUrl2, false); |
| + main_test_rfh()->SendNavigate(0, true, kUrl2); |
|
alexmos
2017/03/04 01:33:25
Would it work to just use contents()->NavigateAndC
iclelland
2017/03/04 05:43:10
It absolutely does. Thanks, done. (Validated manua
|
| + |
| + // 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. |
| + process()->sink().ClearMessages(); |
| + main_test_rfh()->SendRendererInitiatedNavigationRequest(kUrl2, false); |
| + main_test_rfh()->SendNavigate(0, true, 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 |