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

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

Issue 241223002: Start using RenderFrameProxyHost objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moar fixes. Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/site_instance_impl.cc ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/strings/stringprintf.h" 6 #include "base/strings/stringprintf.h"
7 #include "content/browser/frame_host/cross_process_frame_connector.h" 7 #include "content/browser/frame_host/cross_process_frame_connector.h"
8 #include "content/browser/frame_host/frame_tree.h" 8 #include "content/browser/frame_host/frame_tree.h"
9 #include "content/browser/frame_host/render_frame_proxy_host.h" 9 #include "content/browser/frame_host/render_frame_proxy_host.h"
10 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" 10 #include "content/browser/frame_host/render_widget_host_view_child_frame.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 // It is safe to obtain the root frame tree node here, as it doesn't change. 210 // It is safe to obtain the root frame tree node here, as it doesn't change.
211 FrameTreeNode* root = 211 FrameTreeNode* root =
212 static_cast<WebContentsImpl*>(shell()->web_contents())-> 212 static_cast<WebContentsImpl*>(shell()->web_contents())->
213 GetFrameTree()->root(); 213 GetFrameTree()->root();
214 214
215 SitePerProcessWebContentsObserver observer(shell()->web_contents()); 215 SitePerProcessWebContentsObserver observer(shell()->web_contents());
216 216
217 // Load same-site page into iframe. 217 // Load same-site page into iframe.
218 FrameTreeNode* child = root->child_at(0); 218 FrameTreeNode* child = root->child_at(0);
219 LOG(ERROR) << "Load same site page.";
220
219 GURL http_url(test_server()->GetURL("files/title1.html")); 221 GURL http_url(test_server()->GetURL("files/title1.html"));
220 NavigateFrameToURL(child, http_url); 222 NavigateFrameToURL(child, http_url);
221 EXPECT_EQ(http_url, observer.navigation_url()); 223 EXPECT_EQ(http_url, observer.navigation_url());
222 EXPECT_TRUE(observer.navigation_succeeded()); 224 EXPECT_TRUE(observer.navigation_succeeded());
223 { 225 {
224 // There should be only one RenderWidgetHost when there are no 226 // There should be only one RenderWidgetHost when there are no
225 // cross-process iframes. 227 // cross-process iframes.
226 std::set<RenderWidgetHostView*> views_set = 228 std::set<RenderWidgetHostView*> views_set =
227 static_cast<WebContentsImpl*>(shell()->web_contents()) 229 static_cast<WebContentsImpl*>(shell()->web_contents())
228 ->GetRenderWidgetHostViewsInTree(); 230 ->GetRenderWidgetHostViewsInTree();
229 EXPECT_EQ(1U, views_set.size()); 231 EXPECT_EQ(1U, views_set.size());
230 } 232 }
231 RenderFrameProxyHost* proxy_to_parent = 233 RenderFrameProxyHost* proxy_to_parent =
232 child->render_manager()->GetRenderFrameProxyHost( 234 child->render_manager()->GetRenderFrameProxyHost(
233 shell()->web_contents()->GetSiteInstance()); 235 shell()->web_contents()->GetSiteInstance());
234 EXPECT_FALSE(proxy_to_parent); 236 EXPECT_FALSE(proxy_to_parent);
235 237
236 // These must stay in scope with replace_host. 238 // These must stay in scope with replace_host.
237 GURL::Replacements replace_host; 239 GURL::Replacements replace_host;
238 std::string foo_com("foo.com"); 240 std::string foo_com("foo.com");
239 241
240 // Load cross-site page into iframe. 242 // Load cross-site page into iframe.
243 LOG(ERROR) << "Load cross-site page.";
241 GURL cross_site_url(test_server()->GetURL("files/title2.html")); 244 GURL cross_site_url(test_server()->GetURL("files/title2.html"));
242 replace_host.SetHostStr(foo_com); 245 replace_host.SetHostStr(foo_com);
243 cross_site_url = cross_site_url.ReplaceComponents(replace_host); 246 cross_site_url = cross_site_url.ReplaceComponents(replace_host);
244 NavigateFrameToURL(root->child_at(0), cross_site_url); 247 NavigateFrameToURL(root->child_at(0), cross_site_url);
245 EXPECT_EQ(cross_site_url, observer.navigation_url()); 248 EXPECT_EQ(cross_site_url, observer.navigation_url());
246 EXPECT_TRUE(observer.navigation_succeeded()); 249 EXPECT_TRUE(observer.navigation_succeeded());
247 250
248 // Ensure that we have created a new process for the subframe. 251 // Ensure that we have created a new process for the subframe.
249 ASSERT_EQ(1U, root->child_count()); 252 ASSERT_EQ(1U, root->child_count());
250 SiteInstance* site_instance = child->current_frame_host()->GetSiteInstance(); 253 SiteInstance* site_instance = child->current_frame_host()->GetSiteInstance();
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 "server-redirect?" + client_redirect_http_url.spec())); 574 "server-redirect?" + client_redirect_http_url.spec()));
572 EXPECT_TRUE(NavigateIframeToURL(shell(), server_redirect_http_url, "test")); 575 EXPECT_TRUE(NavigateIframeToURL(shell(), server_redirect_http_url, "test"));
573 576
574 // DidFailProvisionalLoad when navigating to client_redirect_http_url. 577 // DidFailProvisionalLoad when navigating to client_redirect_http_url.
575 EXPECT_EQ(observer.navigation_url(), client_redirect_http_url); 578 EXPECT_EQ(observer.navigation_url(), client_redirect_http_url);
576 EXPECT_FALSE(observer.navigation_succeeded()); 579 EXPECT_FALSE(observer.navigation_succeeded());
577 } 580 }
578 } 581 }
579 582
580 } // namespace content 583 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/site_instance_impl.cc ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698