OLD | NEW |
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 "content/browser/site_per_process_browsertest.h" | 5 #include "content/browser/site_per_process_browsertest.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 5941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5952 // Test that the final cert id stored in the navigation entry is the | 5952 // Test that the final cert id stored in the navigation entry is the |
5953 // cert id corresponding to the second renderer process. | 5953 // cert id corresponding to the second renderer process. |
5954 EXPECT_EQ(new_process_id, shell() | 5954 EXPECT_EQ(new_process_id, shell() |
5955 ->web_contents() | 5955 ->web_contents() |
5956 ->GetController() | 5956 ->GetController() |
5957 .GetVisibleEntry() | 5957 .GetVisibleEntry() |
5958 ->GetSSL() | 5958 ->GetSSL() |
5959 .cert_id); | 5959 .cert_id); |
5960 } | 5960 } |
5961 | 5961 |
| 5962 // Tests that the swapped out state on RenderViewHost is properly reset when |
| 5963 // the main frame is navigated to the same SiteInstance as one of its child |
| 5964 // frames. |
| 5965 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 5966 NavigateMainFrameToChildSite) { |
| 5967 GURL main_url(embedded_test_server()->GetURL( |
| 5968 "a.com", "/cross_site_iframe_factory.html?a(b)")); |
| 5969 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 5970 |
| 5971 WebContentsImpl* contents = |
| 5972 static_cast<WebContentsImpl*>(shell()->web_contents()); |
| 5973 FrameTreeNode* root = contents->GetFrameTree()->root(); |
| 5974 EXPECT_EQ(1U, root->child_count()); |
| 5975 |
| 5976 // Ensure the RenderViewHost for the SiteInstance of the child is considered |
| 5977 // in swapped out state. |
| 5978 RenderViewHostImpl* rvh = contents->GetFrameTree()->GetRenderViewHost( |
| 5979 root->child_at(0)->current_frame_host()->GetSiteInstance()); |
| 5980 EXPECT_TRUE(rvh->is_swapped_out_); |
| 5981 |
| 5982 // Have the child frame navigate its parent to its SiteInstance. |
| 5983 GURL b_url(embedded_test_server()->GetURL("b.com", "/title1.html")); |
| 5984 std::string script = base::StringPrintf( |
| 5985 "window.domAutomationController.send(" |
| 5986 "parent.location = '%s');", |
| 5987 b_url.spec().c_str()); |
| 5988 |
| 5989 TestFrameNavigationObserver frame_observer(root); |
| 5990 EXPECT_TRUE(ExecuteScript(root->child_at(0)->current_frame_host(), script)); |
| 5991 frame_observer.Wait(); |
| 5992 EXPECT_EQ(b_url, root->current_url()); |
| 5993 |
| 5994 // Verify that the same RenderViewHost is preserved and that it is no longer |
| 5995 // in swapped out state. |
| 5996 EXPECT_EQ(rvh, contents->GetFrameTree()->GetRenderViewHost( |
| 5997 root->current_frame_host()->GetSiteInstance())); |
| 5998 EXPECT_FALSE(rvh->is_swapped_out_); |
| 5999 } |
| 6000 |
5962 } // namespace content | 6001 } // namespace content |
OLD | NEW |