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

Side by Side Diff: content/browser/site_per_process_browsertest.cc

Issue 1138413002: OOPIF: Don't resurrect a dead process just to create proxies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Return early if process creation failed Created 5 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
« no previous file with comments | « content/browser/frame_host/render_frame_proxy_host.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/browser/site_per_process_browsertest.h" 5 #include "content/browser/site_per_process_browsertest.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 " B = http://b.com/", 882 " B = http://b.com/",
883 DepictFrameTree(root)); 883 DepictFrameTree(root));
884 884
885 // Check that third subframe's proxy is available in the b.com process by 885 // Check that third subframe's proxy is available in the b.com process by
886 // sending it a postMessage from second subframe, and waiting for a reply. 886 // sending it a postMessage from second subframe, and waiting for a reply.
887 PostMessageAndWaitForReply(root->child_at(1), 887 PostMessageAndWaitForReply(root->child_at(1),
888 "postToSibling('subframe-msg','frame3')", 888 "postToSibling('subframe-msg','frame3')",
889 "\"done-frame2\""); 889 "\"done-frame2\"");
890 } 890 }
891 891
892 // Verify that proxy creation doesn't recreate a crashed process if no frame
893 // will be created in it.
894 //
895 // 1 A A A
896 // / | \ / | \ / | \ / | \ .
897 // 2 3 4 -> B A A -> Kill B -> B* A A -> B* A A
898 // \ .
899 // A
900 //
901 // The test kills process B (node 2), creates a child frame of node 4 in
902 // process A, and then checks that process B isn't resurrected to create a
903 // proxy for the new child frame. See https://crbug.com/476846.
904 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
905 CreateChildFrameAfterKillingProcess) {
906 // Navigate to a page with three frames: one cross-site and two same-site.
907 GURL main_url(embedded_test_server()->GetURL(
908 "a.com", "/frame_tree/page_with_three_frames.html"));
909 EXPECT_TRUE(NavigateToURL(shell(), main_url));
910
911 // It is safe to obtain the root frame tree node here, as it doesn't change.
912 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
913 ->GetFrameTree()
914 ->root();
915
916 EXPECT_EQ(
917 " Site A ------------ proxies for B\n"
918 " |--Site B ------- proxies for A\n"
919 " |--Site A ------- proxies for B\n"
920 " +--Site A ------- proxies for B\n"
921 "Where A = http://a.com/\n"
922 " B = http://b.com/",
923 DepictFrameTree(root));
924 SiteInstance* b_site_instance =
925 root->child_at(0)->current_frame_host()->GetSiteInstance();
926
927 // Kill the first subframe's renderer (B).
928 RenderProcessHost* child_process =
929 root->child_at(0)->current_frame_host()->GetProcess();
930 RenderProcessHostWatcher crash_observer(
931 child_process, RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
932 child_process->Shutdown(0, false);
933 crash_observer.Wait();
934
935 // Add a new child frame to the third subframe.
936 RenderFrameHostCreatedObserver frame_observer(shell()->web_contents(), 1);
937 EXPECT_TRUE(ExecuteScript(
938 root->child_at(2)->current_frame_host(),
939 "document.body.appendChild(document.createElement('iframe'));"));
940 frame_observer.Wait();
941
942 // The new frame should have a RenderFrameProxyHost for B, but it should not
943 // be alive, and B should still not have a process (verified by last line of
944 // expected DepictFrameTree output).
945 EXPECT_EQ(
946 " Site A ------------ proxies for B\n"
947 " |--Site B ------- proxies for A\n"
948 " |--Site A ------- proxies for B\n"
949 " +--Site A ------- proxies for B\n"
950 " +--Site A -- proxies for B\n"
951 "Where A = http://a.com/\n"
952 " B = http://b.com/ (no process)",
953 DepictFrameTree(root));
954 FrameTreeNode* grandchild = root->child_at(2)->child_at(0);
955 RenderFrameProxyHost* grandchild_rfph =
956 grandchild->render_manager()->GetRenderFrameProxyHost(b_site_instance);
957 EXPECT_FALSE(grandchild_rfph->is_render_frame_proxy_live());
958
959 // Navigate the second subframe to b.com to recreate process B.
960 TestNavigationObserver observer(shell()->web_contents());
961 GURL b_url = embedded_test_server()->GetURL("b.com", "/title1.html");
962 NavigateFrameToURL(root->child_at(1), b_url);
963 EXPECT_TRUE(observer.last_navigation_succeeded());
964 EXPECT_EQ(b_url, observer.last_navigation_url());
965
966 // Ensure that the grandchild RenderFrameProxy in B was created when process
967 // B was restored.
968 EXPECT_TRUE(grandchild_rfph->is_render_frame_proxy_live());
969 }
970
892 // In A-embed-B-embed-C scenario, verify that killing process B clears proxies 971 // In A-embed-B-embed-C scenario, verify that killing process B clears proxies
893 // of C from the tree. 972 // of C from the tree.
894 // 973 //
895 // 1 A A 974 // 1 A A
896 // / \ / \ / \ . 975 // / \ / \ / \ .
897 // 2 3 -> B A -> Kill B -> B* A 976 // 2 3 -> B A -> Kill B -> B* A
898 // / / 977 // / /
899 // 4 C 978 // 4 C
900 // 979 //
901 // node1 is the root. 980 // node1 is the root.
(...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after
2389 " |--Site A\n" 2468 " |--Site A\n"
2390 " +--Site A\n" 2469 " +--Site A\n"
2391 " |--Site A\n" 2470 " |--Site A\n"
2392 " +--Site A\n" 2471 " +--Site A\n"
2393 " +--Site A\n" 2472 " +--Site A\n"
2394 "Where A = http://127.0.0.1/", 2473 "Where A = http://127.0.0.1/",
2395 DepictFrameTree(root)); 2474 DepictFrameTree(root));
2396 } 2475 }
2397 2476
2398 } // namespace content 2477 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_proxy_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698