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

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

Issue 1785153005: Remove SiteIsolationPolicy::IsSwappedOutStateForbidden(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase on ToT. Created 4 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
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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 EXPECT_EQ(orig_rvh_delete_count, 0); 581 EXPECT_EQ(orig_rvh_delete_count, 0);
582 582
583 // Going back should switch SiteInstances again. The first SiteInstance is 583 // Going back should switch SiteInstances again. The first SiteInstance is
584 // stored in the NavigationEntry, so it should be the same as at the start. 584 // stored in the NavigationEntry, so it should be the same as at the start.
585 // We should use the same RFH as before, swapping it back in. 585 // We should use the same RFH as before, swapping it back in.
586 controller().GoBack(); 586 controller().GoBack();
587 entry_id = controller().GetPendingEntry()->GetUniqueID(); 587 entry_id = controller().GetPendingEntry()->GetUniqueID();
588 if (IsBrowserSideNavigationEnabled()) 588 if (IsBrowserSideNavigationEnabled())
589 contents()->GetMainFrame()->PrepareForCommit(); 589 contents()->GetMainFrame()->PrepareForCommit();
590 TestRenderFrameHost* goback_rfh = contents()->GetPendingMainFrame(); 590 TestRenderFrameHost* goback_rfh = contents()->GetPendingMainFrame();
591 if (!SiteIsolationPolicy::IsSwappedOutStateForbidden()) {
592 // Recycling the rfh is a behavior specific to swappedout://
593 EXPECT_EQ(orig_rfh, goback_rfh);
594 }
595 EXPECT_TRUE(contents()->CrossProcessNavigationPending()); 591 EXPECT_TRUE(contents()->CrossProcessNavigationPending());
596 592
597 // Navigations should be suspended in goback_rfh until BeforeUnloadACK. 593 // Navigations should be suspended in goback_rfh until BeforeUnloadACK.
598 if (!IsBrowserSideNavigationEnabled()) { 594 if (!IsBrowserSideNavigationEnabled()) {
599 EXPECT_TRUE(goback_rfh->are_navigations_suspended()); 595 EXPECT_TRUE(goback_rfh->are_navigations_suspended());
600 pending_rfh->SendBeforeUnloadACK(true); 596 pending_rfh->SendBeforeUnloadACK(true);
601 EXPECT_FALSE(goback_rfh->are_navigations_suspended()); 597 EXPECT_FALSE(goback_rfh->are_navigations_suspended());
602 } 598 }
603 599
604 // DidNavigate from the back action 600 // DidNavigate from the back action
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 popup->SetOpener(contents()); 963 popup->SetOpener(contents());
968 contents()->GetRenderManager()->CreateOpenerProxies(instance, nullptr); 964 contents()->GetRenderManager()->CreateOpenerProxies(instance, nullptr);
969 965
970 // If swapped out is forbidden, a new proxy should be created for the opener 966 // If swapped out is forbidden, a new proxy should be created for the opener
971 // in |instance|, and we should ensure that its routing ID is returned here. 967 // in |instance|, and we should ensure that its routing ID is returned here.
972 // Otherwise, we should find the pending RFH and not create a new proxy. 968 // Otherwise, we should find the pending RFH and not create a new proxy.
973 int opener_frame_routing_id = 969 int opener_frame_routing_id =
974 popup->GetRenderManager()->GetOpenerRoutingID(instance); 970 popup->GetRenderManager()->GetOpenerRoutingID(instance);
975 RenderFrameProxyHost* proxy = 971 RenderFrameProxyHost* proxy =
976 contents()->GetRenderManager()->GetRenderFrameProxyHost(instance); 972 contents()->GetRenderManager()->GetRenderFrameProxyHost(instance);
977 if (SiteIsolationPolicy::IsSwappedOutStateForbidden()) { 973 EXPECT_TRUE(proxy);
978 EXPECT_TRUE(proxy); 974 EXPECT_EQ(proxy->GetRoutingID(), opener_frame_routing_id);
979 EXPECT_EQ(proxy->GetRoutingID(), opener_frame_routing_id);
980 975
981 // Ensure that committing the navigation removes the proxy. 976 // Ensure that committing the navigation removes the proxy.
982 int entry_id = controller().GetPendingEntry()->GetUniqueID(); 977 entry_id = controller().GetPendingEntry()->GetUniqueID();
983 contents()->TestDidNavigate(pending_rfh, 2, entry_id, true, url2, 978 contents()->TestDidNavigate(pending_rfh, 2, entry_id, true, url2,
984 ui::PAGE_TRANSITION_TYPED); 979 ui::PAGE_TRANSITION_TYPED);
985 EXPECT_FALSE( 980 EXPECT_FALSE(
986 contents()->GetRenderManager()->GetRenderFrameProxyHost(instance)); 981 contents()->GetRenderManager()->GetRenderFrameProxyHost(instance));
987 } else {
988 EXPECT_FALSE(proxy);
989 EXPECT_EQ(pending_rfh->GetRoutingID(), opener_frame_routing_id);
990 }
991 } 982 }
992 983
993 // Tests that WebContentsImpl uses the current URL, not the SiteInstance's site, 984 // Tests that WebContentsImpl uses the current URL, not the SiteInstance's site,
994 // to determine whether a navigation is cross-site. 985 // to determine whether a navigation is cross-site.
995 TEST_F(WebContentsImplTest, CrossSiteComparesAgainstCurrentPage) { 986 TEST_F(WebContentsImplTest, CrossSiteComparesAgainstCurrentPage) {
996 TestRenderFrameHost* orig_rfh = contents()->GetMainFrame(); 987 TestRenderFrameHost* orig_rfh = contents()->GetMainFrame();
997 SiteInstance* instance1 = contents()->GetSiteInstance(); 988 SiteInstance* instance1 = contents()->GetSiteInstance();
998 989
999 // Navigate to URL. 990 // Navigate to URL.
1000 const GURL url("http://www.google.com"); 991 const GURL url("http://www.google.com");
(...skipping 2440 matching lines...) Expand 10 before | Expand all | Expand 10 after
3441 // An automatic navigation. 3432 // An automatic navigation.
3442 contents()->GetMainFrame()->SendNavigateWithModificationCallback( 3433 contents()->GetMainFrame()->SendNavigateWithModificationCallback(
3443 2, 0, true, GURL(url::kAboutBlankURL), base::Bind(SetAsNonUserGesture)); 3434 2, 0, true, GURL(url::kAboutBlankURL), base::Bind(SetAsNonUserGesture));
3444 3435
3445 EXPECT_EQ(1u, delegate->reset_count()); 3436 EXPECT_EQ(1u, delegate->reset_count());
3446 3437
3447 contents()->SetJavaScriptDialogManagerForTesting(nullptr); 3438 contents()->SetJavaScriptDialogManagerForTesting(nullptr);
3448 } 3439 }
3449 3440
3450 } // namespace content 3441 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/common/site_isolation_policy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698