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/frame_host/frame_tree_browsertest.cc

Issue 536143002: Do not create proxy hosts in the subtree of navigating frame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix CrossSiteIframe asserts. Created 6 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "content/browser/frame_host/frame_tree.h" 6 #include "content/browser/frame_host/frame_tree.h"
7 #include "content/browser/frame_host/frame_tree_node.h" 7 #include "content/browser/frame_host/frame_tree_node.h"
8 #include "content/browser/renderer_host/render_view_host_impl.h" 8 #include "content/browser/renderer_host/render_view_host_impl.h"
9 #include "content/browser/web_contents/web_contents_impl.h" 9 #include "content/browser/web_contents/web_contents_impl.h"
10 #include "content/public/browser/notification_service.h" 10 #include "content/public/browser/notification_service.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 GURL::Replacements replace_host; 199 GURL::Replacements replace_host;
200 std::string foo_com("foo.com"); 200 std::string foo_com("foo.com");
201 201
202 // Load cross-site page into iframe. 202 // Load cross-site page into iframe.
203 GURL cross_site_url(test_server()->GetURL("files/title2.html")); 203 GURL cross_site_url(test_server()->GetURL("files/title2.html"));
204 replace_host.SetHostStr(foo_com); 204 replace_host.SetHostStr(foo_com);
205 cross_site_url = cross_site_url.ReplaceComponents(replace_host); 205 cross_site_url = cross_site_url.ReplaceComponents(replace_host);
206 NavigateFrameToURL(root->child_at(0), cross_site_url); 206 NavigateFrameToURL(root->child_at(0), cross_site_url);
207 207
208 // Ensure that we have created a new process for the subframe. 208 // Ensure that we have created a new process for the subframe.
209 ASSERT_EQ(1U, root->child_count()); 209 ASSERT_EQ(2U, root->child_count());
210 FrameTreeNode* child = root->child_at(0); 210 FrameTreeNode* child = root->child_at(0);
211 SiteInstance* child_instance = child->current_frame_host()->GetSiteInstance(); 211 SiteInstance* child_instance = child->current_frame_host()->GetSiteInstance();
212 RenderViewHost* rvh = child->current_frame_host()->render_view_host(); 212 RenderViewHost* rvh = child->current_frame_host()->render_view_host();
213 RenderProcessHost* rph = child->current_frame_host()->GetProcess(); 213 RenderProcessHost* rph = child->current_frame_host()->GetProcess();
214 214
215 EXPECT_NE(shell()->web_contents()->GetRenderViewHost(), rvh); 215 EXPECT_NE(shell()->web_contents()->GetRenderViewHost(), rvh);
216 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), child_instance); 216 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), child_instance);
217 EXPECT_NE(shell()->web_contents()->GetRenderProcessHost(), rph); 217 EXPECT_NE(shell()->web_contents()->GetRenderProcessHost(), rph);
218 218
219 // Ensure that the root node has a proxy for the child node's SiteInstance. 219 // Ensure that the root node has a proxy for the child node's SiteInstance.
220 EXPECT_TRUE(root->render_manager()->GetRenderFrameProxyHost(child_instance)); 220 EXPECT_TRUE(root->render_manager()->GetRenderFrameProxyHost(child_instance));
221 221
222 // Also ensure that the child has a proxy for the root node's SiteInstance. 222 // Also ensure that the child has a proxy for the root node's SiteInstance.
223 EXPECT_TRUE(child->render_manager()->GetRenderFrameProxyHost(root_instance)); 223 EXPECT_TRUE(child->render_manager()->GetRenderFrameProxyHost(root_instance));
224 224
225 // The nodes should not have proxies for their own SiteInstance. 225 // The nodes should not have proxies for their own SiteInstance.
226 EXPECT_FALSE(root->render_manager()->GetRenderFrameProxyHost(root_instance)); 226 EXPECT_FALSE(root->render_manager()->GetRenderFrameProxyHost(root_instance));
227 EXPECT_FALSE( 227 EXPECT_FALSE(
228 child->render_manager()->GetRenderFrameProxyHost(child_instance)); 228 child->render_manager()->GetRenderFrameProxyHost(child_instance));
229 } 229 }
230 230
231 } // namespace content 231 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/frame_tree.cc ('k') | content/browser/frame_host/render_frame_host_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698