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

Side by Side Diff: content/browser/web_contents/web_contents_impl_unittest.cc

Issue 2921063003: Fix process reuse for dedicated processes when over process limit. (Closed)
Patch Set: Cleanup Created 3 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include <utility> 6 #include <utility>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 entry_id = controller().GetPendingEntry()->GetUniqueID(); 978 entry_id = controller().GetPendingEntry()->GetUniqueID();
979 contents()->TestDidNavigate(pending_rfh, entry_id, true, url2, 979 contents()->TestDidNavigate(pending_rfh, entry_id, true, url2,
980 ui::PAGE_TRANSITION_TYPED); 980 ui::PAGE_TRANSITION_TYPED);
981 EXPECT_FALSE( 981 EXPECT_FALSE(
982 contents()->GetRenderManager()->GetRenderFrameProxyHost(instance)); 982 contents()->GetRenderManager()->GetRenderFrameProxyHost(instance));
983 } 983 }
984 984
985 // Tests that WebContentsImpl uses the current URL, not the SiteInstance's site, 985 // Tests that WebContentsImpl uses the current URL, not the SiteInstance's site,
986 // to determine whether a navigation is cross-site. 986 // to determine whether a navigation is cross-site.
987 TEST_F(WebContentsImplTest, CrossSiteComparesAgainstCurrentPage) { 987 TEST_F(WebContentsImplTest, CrossSiteComparesAgainstCurrentPage) {
988 // The assumptions this test makes aren't valid with --site-per-process. For
989 // example, a cross-site URL won't ever commit in the old RFH.
990 if (AreAllSitesIsolatedForTesting())
991 return;
992
988 TestRenderFrameHost* orig_rfh = main_test_rfh(); 993 TestRenderFrameHost* orig_rfh = main_test_rfh();
989 SiteInstance* instance1 = contents()->GetSiteInstance(); 994 SiteInstance* instance1 = contents()->GetSiteInstance();
990 995
991 // Navigate to URL. 996 // Navigate to URL.
992 const GURL url("http://www.google.com"); 997 const GURL url("http://www.google.com");
993 controller().LoadURL( 998 controller().LoadURL(
994 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); 999 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
995 int entry_id = controller().GetPendingEntry()->GetUniqueID(); 1000 int entry_id = controller().GetPendingEntry()->GetUniqueID();
996 main_test_rfh()->PrepareForCommit(); 1001 main_test_rfh()->PrepareForCommit();
997 contents()->TestDidNavigate(orig_rfh, entry_id, true, url, 1002 contents()->TestDidNavigate(orig_rfh, entry_id, true, url,
(...skipping 17 matching lines...) Expand all
1015 ui::PAGE_TRANSITION_TYPED); 1020 ui::PAGE_TRANSITION_TYPED);
1016 SiteInstance* instance2 = contents2->GetSiteInstance(); 1021 SiteInstance* instance2 = contents2->GetSiteInstance();
1017 EXPECT_NE(instance1, instance2); 1022 EXPECT_NE(instance1, instance2);
1018 EXPECT_FALSE(contents2->CrossProcessNavigationPending()); 1023 EXPECT_FALSE(contents2->CrossProcessNavigationPending());
1019 1024
1020 // Simulate a link click in first contents to second site. Doesn't switch 1025 // Simulate a link click in first contents to second site. Doesn't switch
1021 // SiteInstances, because we don't intercept Blink navigations. 1026 // SiteInstances, because we don't intercept Blink navigations.
1022 orig_rfh->SendRendererInitiatedNavigationRequest(url2, true); 1027 orig_rfh->SendRendererInitiatedNavigationRequest(url2, true);
1023 orig_rfh->PrepareForCommit(); 1028 orig_rfh->PrepareForCommit();
1024 contents()->TestDidNavigate(orig_rfh, 0, true, url2, 1029 contents()->TestDidNavigate(orig_rfh, 0, true, url2,
1025 ui::PAGE_TRANSITION_TYPED); 1030 ui::PAGE_TRANSITION_TYPED);
Charlie Reis 2017/06/12 23:08:17 It's unfortunate this wasn't failing already befor
alexmos 2017/06/14 22:39:05 Yes, and that's a really good idea to start catchi
1026 SiteInstance* instance3 = contents()->GetSiteInstance(); 1031 SiteInstance* instance3 = contents()->GetSiteInstance();
1027 EXPECT_EQ(instance1, instance3); 1032 EXPECT_EQ(instance1, instance3);
1028 EXPECT_FALSE(contents()->CrossProcessNavigationPending()); 1033 EXPECT_FALSE(contents()->CrossProcessNavigationPending());
1029 1034
1030 // Navigate to the new site. Doesn't switch SiteInstancees, because we 1035 // Navigate to the new site. Doesn't switch SiteInstancees, because we
1031 // compare against the current URL, not the SiteInstance's site. 1036 // compare against the current URL, not the SiteInstance's site.
1032 const GURL url3("http://mail.yahoo.com"); 1037 const GURL url3("http://mail.yahoo.com");
1033 controller().LoadURL( 1038 controller().LoadURL(
1034 url3, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); 1039 url3, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
1035 entry_id = controller().GetPendingEntry()->GetUniqueID(); 1040 entry_id = controller().GetPendingEntry()->GetUniqueID();
(...skipping 2407 matching lines...) Expand 10 before | Expand all | Expand 10 after
3443 // An automatic navigation. 3448 // An automatic navigation.
3444 main_test_rfh()->SendNavigateWithModificationCallback( 3449 main_test_rfh()->SendNavigateWithModificationCallback(
3445 0, true, GURL(url::kAboutBlankURL), base::Bind(SetAsNonUserGesture)); 3450 0, true, GURL(url::kAboutBlankURL), base::Bind(SetAsNonUserGesture));
3446 3451
3447 EXPECT_EQ(1u, dialog_manager.reset_count()); 3452 EXPECT_EQ(1u, dialog_manager.reset_count());
3448 3453
3449 contents()->SetJavaScriptDialogManagerForTesting(nullptr); 3454 contents()->SetJavaScriptDialogManagerForTesting(nullptr);
3450 } 3455 }
3451 3456
3452 } // namespace content 3457 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698