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

Side by Side 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, 9 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 unified diff | Download patch
« no previous file with comments | « content/browser/frame_host/navigator_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/feature_list.h" 7 #include "base/feature_list.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 EXPECT_TRUE(node->navigation_request()); 1233 EXPECT_TRUE(node->navigation_request());
1234 1234
1235 // The first navigation commits. This should clear up the speculative RFH and 1235 // The first navigation commits. This should clear up the speculative RFH and
1236 // the ongoing NavigationRequest. 1236 // the ongoing NavigationRequest.
1237 speculative_rfh->SendNavigate(entry_id, true, kUrl2); 1237 speculative_rfh->SendNavigate(entry_id, true, kUrl2);
1238 EXPECT_FALSE(node->navigation_request()); 1238 EXPECT_FALSE(node->navigation_request());
1239 EXPECT_FALSE(GetSpeculativeRenderFrameHost(node)); 1239 EXPECT_FALSE(GetSpeculativeRenderFrameHost(node));
1240 EXPECT_EQ(speculative_rfh, main_test_rfh()); 1240 EXPECT_EQ(speculative_rfh, main_test_rfh());
1241 } 1241 }
1242 1242
1243 // Feature Policy: Test that the feature policy is reset when navigating pages
1244 // within a site.
1245 TEST_F(NavigatorTestWithBrowserSideNavigation,
1246 FeaturePolicySameSiteNavigation) {
1247 const GURL kUrl1("http://www.chromium.org/");
1248 const GURL kUrl2("http://www.chromium.org/Home");
1249
1250 contents()->NavigateAndCommit(kUrl1);
1251
1252 // Check the feature policy before navigation.
1253 FeaturePolicy* original_feature_policy =
1254 main_test_rfh()->get_feature_policy();
1255 ASSERT_TRUE(original_feature_policy);
1256
1257 // Navigate to the new URL.
1258 contents()->NavigateAndCommit(kUrl2);
1259
1260 // Check the feature policy after navigation.
1261 FeaturePolicy* final_feature_policy = main_test_rfh()->get_feature_policy();
1262 ASSERT_TRUE(final_feature_policy);
1263 ASSERT_NE(original_feature_policy, final_feature_policy);
1264 }
1265
1266 // Feature Policy: Test that the feature policy is not reset when navigating
1267 // within a page.
1268 TEST_F(NavigatorTestWithBrowserSideNavigation,
1269 FeaturePolicyFragmentNavigation) {
1270 const GURL kUrl1("http://www.chromium.org/");
1271 const GURL kUrl2("http://www.chromium.org/#Home");
1272
1273 contents()->NavigateAndCommit(kUrl1);
1274
1275 // Check the feature policy before navigation.
1276 FeaturePolicy* original_feature_policy =
1277 main_test_rfh()->get_feature_policy();
1278 ASSERT_TRUE(original_feature_policy);
1279
1280 // Navigate to the new URL.
1281 contents()->NavigateAndCommit(kUrl2);
1282
1283 // Check the feature policy after navigation.
1284 FeaturePolicy* final_feature_policy = main_test_rfh()->get_feature_policy();
1285 ASSERT_EQ(original_feature_policy, final_feature_policy);
1286 }
1287
1243 } // namespace content 1288 } // namespace content
OLDNEW
« 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