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

Unified Diff: content/browser/site_per_process_browsertest.cc

Issue 117603002: Always create FrameTreeNodes and RenderFrameHosts for every frame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix prerendering. Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/frame_host/frame_tree_browsertest.cc ('k') | content/content_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/site_per_process_browsertest.cc
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc
index db3a43c523e2a2053992f37d93b89f43395e321e..1523ec543d674def40af35ebff109ed8766a8ffc 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -444,150 +444,6 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
}
}
-// Ensures FrameTree correctly reflects page structure during navigations.
-IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
- FrameTreeShape) {
- host_resolver()->AddRule("*", "127.0.0.1");
- ASSERT_TRUE(test_server()->Start());
-
- GURL base_url = test_server()->GetURL("files/site_isolation/");
- GURL::Replacements replace_host;
- std::string host_str("A.com"); // Must stay in scope with replace_host.
- replace_host.SetHostStr(host_str);
- base_url = base_url.ReplaceComponents(replace_host);
-
- // Load doc without iframes. Verify FrameTree just has root.
- // Frame tree:
- // Site-A Root
- NavigateToURL(shell(), base_url.Resolve("blank.html"));
- FrameTreeNode* root =
- static_cast<WebContentsImpl*>(shell()->web_contents())->
- GetFrameTree()->root();
- EXPECT_EQ(0U, root->child_count());
-
- // Add 2 same-site frames. Verify 3 nodes in tree with proper names.
- // Frame tree:
- // Site-A Root -- Site-A frame1
- // \-- Site-A frame2
- WindowedNotificationObserver observer1(
- content::NOTIFICATION_LOAD_STOP,
- content::Source<NavigationController>(
- &shell()->web_contents()->GetController()));
- NavigateToURL(shell(), base_url.Resolve("frames-X-X.html"));
- observer1.Wait();
- ASSERT_EQ(2U, root->child_count());
- EXPECT_EQ(0U, root->child_at(0)->child_count());
- EXPECT_EQ(0U, root->child_at(1)->child_count());
-}
-
-// TODO(ajwong): Talk with nasko and merge this functionality with
-// FrameTreeShape.
-IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
- FrameTreeShape2) {
- host_resolver()->AddRule("*", "127.0.0.1");
- ASSERT_TRUE(test_server()->Start());
-
- NavigateToURL(shell(),
- test_server()->GetURL("files/frame_tree/top.html"));
-
- WebContentsImpl* wc = static_cast<WebContentsImpl*>(shell()->web_contents());
- RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
- wc->GetRenderViewHost());
- FrameTreeNode* root = wc->GetFrameTree()->root();
-
- // Check that the root node is properly created with the frame id of the
- // initial navigation.
- ASSERT_EQ(3UL, root->child_count());
- EXPECT_EQ(std::string(), root->frame_name());
- EXPECT_EQ(rvh->main_frame_id(), root->frame_id());
-
- ASSERT_EQ(2UL, root->child_at(0)->child_count());
- EXPECT_STREQ("1-1-name", root->child_at(0)->frame_name().c_str());
-
- // Verify the deepest node exists and has the right name.
- ASSERT_EQ(2UL, root->child_at(2)->child_count());
- EXPECT_EQ(1UL, root->child_at(2)->child_at(1)->child_count());
- EXPECT_EQ(0UL, root->child_at(2)->child_at(1)->child_at(0)->child_count());
- EXPECT_STREQ("3-1-id",
- root->child_at(2)->child_at(1)->child_at(0)->frame_name().c_str());
-
- // Navigate to about:blank, which should leave only the root node of the frame
- // tree in the browser process.
- NavigateToURL(shell(), test_server()->GetURL("files/title1.html"));
-
- root = wc->GetFrameTree()->root();
- EXPECT_EQ(0UL, root->child_count());
- EXPECT_EQ(std::string(), root->frame_name());
- EXPECT_EQ(rvh->main_frame_id(), root->frame_id());
-}
-
-// Test that we can navigate away if the previous renderer doesn't clean up its
-// child frames.
-IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, FrameTreeAfterCrash) {
- ASSERT_TRUE(test_server()->Start());
- NavigateToURL(shell(),
- test_server()->GetURL("files/frame_tree/top.html"));
-
- // Crash the renderer so that it doesn't send any FrameDetached messages.
- RenderProcessHostWatcher crash_observer(
- shell()->web_contents(),
- RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
- NavigateToURL(shell(), GURL(kChromeUICrashURL));
- crash_observer.Wait();
-
- // The frame tree should be cleared, and the frame ID should be reset.
- WebContentsImpl* wc = static_cast<WebContentsImpl*>(shell()->web_contents());
- RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
- wc->GetRenderViewHost());
- FrameTreeNode* root = wc->GetFrameTree()->root();
- EXPECT_EQ(0UL, root->child_count());
- EXPECT_EQ(FrameTreeNode::kInvalidFrameId, root->frame_id());
- EXPECT_EQ(rvh->main_frame_id(), root->frame_id());
-
- // Navigate to a new URL.
- NavigateToURL(shell(), test_server()->GetURL("files/title1.html"));
-
- // The frame ID should now be set.
- EXPECT_EQ(0UL, root->child_count());
- EXPECT_NE(FrameTreeNode::kInvalidFrameId, root->frame_id());
- EXPECT_EQ(rvh->main_frame_id(), root->frame_id());
-}
-
-// Test that we can navigate away if the previous renderer doesn't clean up its
-// child frames.
-IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigateWithLeftoverFrames) {
- host_resolver()->AddRule("*", "127.0.0.1");
- ASSERT_TRUE(test_server()->Start());
-
- GURL base_url = test_server()->GetURL("files/site_isolation/");
- GURL::Replacements replace_host;
- std::string host_str("A.com"); // Must stay in scope with replace_host.
- replace_host.SetHostStr(host_str);
- base_url = base_url.ReplaceComponents(replace_host);
-
- NavigateToURL(shell(),
- test_server()->GetURL("files/frame_tree/top.html"));
-
- // Hang the renderer so that it doesn't send any FrameDetached messages.
- // (This navigation will never complete, so don't wait for it.)
- shell()->LoadURL(GURL(kChromeUIHangURL));
-
- // Check that the frame tree still has children.
- WebContentsImpl* wc = static_cast<WebContentsImpl*>(shell()->web_contents());
- FrameTreeNode* root = wc->GetFrameTree()->root();
- ASSERT_EQ(3UL, root->child_count());
-
- // Navigate to a new URL. We use LoadURL because NavigateToURL will try to
- // wait for the previous navigation to stop.
- TestNavigationObserver tab_observer(wc, 1);
- shell()->LoadURL(base_url.Resolve("blank.html"));
- tab_observer.Wait();
-
- // The frame tree should now be cleared, and the frame ID should be valid.
- EXPECT_EQ(0UL, root->child_count());
- EXPECT_NE(FrameTreeNode::kInvalidFrameId, root->frame_id());
-}
-
// Tests that the |should_replace_current_entry| flag persists correctly across
// request transfers that began with a cross-process navigation.
IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
« no previous file with comments | « content/browser/frame_host/frame_tree_browsertest.cc ('k') | content/content_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698