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 <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 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1024 EXPECT_EQ(shell()->web_contents()->GetSiteInstance(), | 1024 EXPECT_EQ(shell()->web_contents()->GetSiteInstance(), |
1025 root->child_at(1)->current_frame_host()->GetSiteInstance()); | 1025 root->child_at(1)->current_frame_host()->GetSiteInstance()); |
1026 | 1026 |
1027 ASSERT_EQ(1U, root->child_at(0)->child_count()); | 1027 ASSERT_EQ(1U, root->child_at(0)->child_count()); |
1028 | 1028 |
1029 // Make sure node4 points to the correct cross-site-page. | 1029 // Make sure node4 points to the correct cross-site-page. |
1030 FrameTreeNode* node4 = root->child_at(0)->child_at(0); | 1030 FrameTreeNode* node4 = root->child_at(0)->child_at(0); |
1031 GURL site_c_url(embedded_test_server()->GetURL("baz.com", "/title1.html")); | 1031 GURL site_c_url(embedded_test_server()->GetURL("baz.com", "/title1.html")); |
1032 EXPECT_EQ(site_c_url, node4->current_url()); | 1032 EXPECT_EQ(site_c_url, node4->current_url()); |
1033 | 1033 |
1034 // |site_instance_c| is expected to go away once we kill |child_process_b| | 1034 // |site_instance_c|'s frames and proxies are expected to go away once we kill |
1035 // below; refcount it to extend the lifetime. | 1035 // |child_process_b| below. |
1036 scoped_refptr<SiteInstanceImpl> site_instance_c = | 1036 scoped_refptr<SiteInstanceImpl> site_instance_c = |
1037 node4->current_frame_host()->GetSiteInstance(); | 1037 node4->current_frame_host()->GetSiteInstance(); |
1038 | 1038 |
1039 // Initially proxies for both B and C will be present in the root. | 1039 // Initially proxies for both B and C will be present in the root. |
1040 EXPECT_EQ( | 1040 EXPECT_EQ( |
1041 " Site A ------------ proxies for B C\n" | 1041 " Site A ------------ proxies for B C\n" |
1042 " |--Site B ------- proxies for A C\n" | 1042 " |--Site B ------- proxies for A C\n" |
1043 " | +--Site C -- proxies for A B\n" | 1043 " | +--Site C -- proxies for A B\n" |
1044 " +--Site A ------- proxies for B C\n" | 1044 " +--Site A ------- proxies for B C\n" |
1045 "Where A = http://a.com/\n" | 1045 "Where A = http://a.com/\n" |
1046 " B = http://bar.com/\n" | 1046 " B = http://bar.com/\n" |
1047 " C = http://baz.com/", | 1047 " C = http://baz.com/", |
1048 DepictFrameTree(root)); | 1048 DepictFrameTree(root)); |
1049 EXPECT_GT(site_instance_c->active_frame_count(), 0U); | |
1050 EXPECT_TRUE( | |
1051 root->render_manager()->GetRenderFrameProxyHost(site_instance_c.get())); | |
1052 | |
1049 // Kill process B. | 1053 // Kill process B. |
1050 RenderProcessHost* child_process_b = | 1054 RenderProcessHost* child_process_b = |
1051 root->child_at(0)->current_frame_host()->GetProcess(); | 1055 root->child_at(0)->current_frame_host()->GetProcess(); |
1052 RenderProcessHostWatcher crash_observer( | 1056 RenderProcessHostWatcher crash_observer( |
1053 child_process_b, RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); | 1057 child_process_b, RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); |
1054 child_process_b->Shutdown(0, false); | 1058 child_process_b->Shutdown(0, false); |
1055 crash_observer.Wait(); | 1059 crash_observer.Wait(); |
1056 | 1060 |
1057 // Make sure proxy C has gone from root. | 1061 // Make sure proxy C has gone from root. |
1058 // Make sure proxy C has gone from node3 as well. | 1062 // Make sure proxy C has gone from node3 as well. |
1059 // Make sure proxy B stays around in root and node3. | 1063 // Make sure proxy B stays around in root and node3. |
1060 EXPECT_EQ( | 1064 EXPECT_EQ( |
1061 " Site A ------------ proxies for B\n" | 1065 " Site A ------------ proxies for B\n" |
1062 " |--Site B ------- proxies for A\n" | 1066 " |--Site B ------- proxies for A\n" |
1063 " +--Site A ------- proxies for B\n" | 1067 " +--Site A ------- proxies for B\n" |
1064 "Where A = http://a.com/\n" | 1068 "Where A = http://a.com/\n" |
1065 " B = http://bar.com/ (no process)", | 1069 " B = http://bar.com/ (no process)", |
1066 DepictFrameTree(root)); | 1070 DepictFrameTree(root)); |
1067 | 1071 |
1068 EXPECT_TRUE(site_instance_c->HasOneRef()); | 1072 EXPECT_EQ(0U, site_instance_c->active_frame_count()); |
1073 EXPECT_FALSE( | |
1074 root->render_manager()->GetRenderFrameProxyHost(site_instance_c.get())); | |
ncarter (slow)
2015/05/27 19:44:26
This EXPECT (and the one on line 1050) is redundan
| |
1069 } | 1075 } |
1070 | 1076 |
1071 // Crash a subframe and ensures its children are cleared from the FrameTree. | 1077 // Crash a subframe and ensures its children are cleared from the FrameTree. |
1072 // See http://crbug.com/338508. | 1078 // See http://crbug.com/338508. |
1073 // TODO(creis): Disabled for flakiness; see http://crbug.com/405582. | 1079 // TODO(creis): Disabled for flakiness; see http://crbug.com/405582. |
1074 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DISABLED_CrashSubframe) { | 1080 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DISABLED_CrashSubframe) { |
1075 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); | 1081 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); |
1076 NavigateToURL(shell(), main_url); | 1082 NavigateToURL(shell(), main_url); |
1077 | 1083 |
1078 StartFrameAtDataURL(); | 1084 StartFrameAtDataURL(); |
(...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2495 " |--Site A\n" | 2501 " |--Site A\n" |
2496 " +--Site A\n" | 2502 " +--Site A\n" |
2497 " |--Site A\n" | 2503 " |--Site A\n" |
2498 " +--Site A\n" | 2504 " +--Site A\n" |
2499 " +--Site A\n" | 2505 " +--Site A\n" |
2500 "Where A = http://127.0.0.1/", | 2506 "Where A = http://127.0.0.1/", |
2501 DepictFrameTree(root)); | 2507 DepictFrameTree(root)); |
2502 } | 2508 } |
2503 | 2509 |
2504 } // namespace content | 2510 } // namespace content |
OLD | NEW |