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

Side by Side Diff: content/browser/frame_host/navigator_impl_unittest.cc

Issue 2857213005: PlzNavigate: implement process reuse for ServiceWorkers (Closed)
Patch Set: Addressed comments + fixed tests Created 3 years, 7 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
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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 if (AreAllSitesIsolatedForTesting()) { 245 if (AreAllSitesIsolatedForTesting()) {
246 EXPECT_TRUE( 246 EXPECT_TRUE(
247 DidRenderFrameHostRequestCommit(GetSpeculativeRenderFrameHost(node))); 247 DidRenderFrameHostRequestCommit(GetSpeculativeRenderFrameHost(node)));
248 } else { 248 } else {
249 EXPECT_TRUE(DidRenderFrameHostRequestCommit(main_test_rfh())); 249 EXPECT_TRUE(DidRenderFrameHostRequestCommit(main_test_rfh()));
250 } 250 }
251 EXPECT_TRUE(main_test_rfh()->is_loading()); 251 EXPECT_TRUE(main_test_rfh()->is_loading());
252 EXPECT_FALSE(node->navigation_request()); 252 EXPECT_FALSE(node->navigation_request());
253 253
254 // Commit the navigation. 254 // Commit the navigation.
255 main_test_rfh()->SendNavigate(0, true, kUrl2); 255 if (AreAllSitesIsolatedForTesting()) {
256 GetSpeculativeRenderFrameHost(node)->SendNavigate(0, true, kUrl2);
257 } else {
258 main_test_rfh()->SendNavigate(0, true, kUrl2);
259 }
256 EXPECT_TRUE(main_test_rfh()->is_active()); 260 EXPECT_TRUE(main_test_rfh()->is_active());
257 EXPECT_EQ(kUrl2, contents()->GetLastCommittedURL()); 261 EXPECT_EQ(kUrl2, contents()->GetLastCommittedURL());
258 EXPECT_FALSE(GetSpeculativeRenderFrameHost(node)); 262 EXPECT_FALSE(GetSpeculativeRenderFrameHost(node));
259 EXPECT_FALSE(node->render_manager()->pending_frame_host()); 263 EXPECT_FALSE(node->render_manager()->pending_frame_host());
260 264
261 // The SiteInstance did not change. 265 // The SiteInstance did not change unless site-per-process is enabled.
262 EXPECT_EQ(site_instance_id_1, main_test_rfh()->GetSiteInstance()->GetId()); 266 if (AreAllSitesIsolatedForTesting()) {
267 EXPECT_NE(site_instance_id_1, main_test_rfh()->GetSiteInstance()->GetId());
268 } else {
269 EXPECT_EQ(site_instance_id_1, main_test_rfh()->GetSiteInstance()->GetId());
270 }
263 } 271 }
264 272
265 // PlzNavigate: Test that a beforeUnload denial cancels the navigation. 273 // PlzNavigate: Test that a beforeUnload denial cancels the navigation.
266 TEST_F(NavigatorTestWithBrowserSideNavigation, 274 TEST_F(NavigatorTestWithBrowserSideNavigation,
267 BeforeUnloadDenialCancelNavigation) { 275 BeforeUnloadDenialCancelNavigation) {
268 const GURL kUrl1("http://www.google.com/"); 276 const GURL kUrl1("http://www.google.com/");
269 const GURL kUrl2("http://www.chromium.org/"); 277 const GURL kUrl2("http://www.chromium.org/");
270 278
271 contents()->NavigateAndCommit(kUrl1); 279 contents()->NavigateAndCommit(kUrl1);
272 280
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 InitNavigateParams(&params, 1, false, kUrl2, 1307 InitNavigateParams(&params, 1, false, kUrl2,
1300 ui::PAGE_TRANSITION_AUTO_SUBFRAME); 1308 ui::PAGE_TRANSITION_AUTO_SUBFRAME);
1301 subframe_rfh->SendNavigateWithParams(&params); 1309 subframe_rfh->SendNavigateWithParams(&params);
1302 1310
1303 FeaturePolicy* subframe_feature_policy = subframe_rfh->feature_policy(); 1311 FeaturePolicy* subframe_feature_policy = subframe_rfh->feature_policy();
1304 ASSERT_TRUE(subframe_feature_policy); 1312 ASSERT_TRUE(subframe_feature_policy);
1305 ASSERT_FALSE(subframe_feature_policy->origin_.unique()); 1313 ASSERT_FALSE(subframe_feature_policy->origin_.unique());
1306 } 1314 }
1307 1315
1308 } // namespace content 1316 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_request.cc ('k') | content/browser/frame_host/render_frame_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698