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

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

Issue 574403002: If a RemoteFrame asks to navigate, send an OpenURL IPC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable new test on android/chrome, like others in the same file Created 6 years, 2 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 (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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "content/browser/frame_host/cross_process_frame_connector.h" 9 #include "content/browser/frame_host/cross_process_frame_connector.h"
10 #include "content/browser/frame_host/frame_tree.h" 10 #include "content/browser/frame_host/frame_tree.h"
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 ->GetRenderWidgetHostViewsInTree(); 292 ->GetRenderWidgetHostViewsInTree();
293 EXPECT_EQ(2U, views_set.size()); 293 EXPECT_EQ(2U, views_set.size());
294 } 294 }
295 EXPECT_EQ(proxy_to_parent, child->render_manager()->GetProxyToParent()); 295 EXPECT_EQ(proxy_to_parent, child->render_manager()->GetProxyToParent());
296 EXPECT_TRUE(proxy_to_parent->cross_process_frame_connector()); 296 EXPECT_TRUE(proxy_to_parent->cross_process_frame_connector());
297 EXPECT_EQ( 297 EXPECT_EQ(
298 child->current_frame_host()->render_view_host()->GetView(), 298 child->current_frame_host()->render_view_host()->GetView(),
299 proxy_to_parent->cross_process_frame_connector()->get_view_for_testing()); 299 proxy_to_parent->cross_process_frame_connector()->get_view_for_testing());
300 } 300 }
301 301
302 // It fails on ChromeOS and Android, so disabled while investigating.
303 // http://crbug.com/399775
304 #if defined(OS_ANDROID) || defined(OS_CHROMEOS)
305 #define MAYBE_NavigateRemoteFrame DISABLED_NavigateRemoteFrame
306 #else
307 #define MAYBE_NavigateRemoteFrame NavigateRemoteFrame
308 #endif
309 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, MAYBE_NavigateRemoteFrame) {
310 host_resolver()->AddRule("*", "127.0.0.1");
311 ASSERT_TRUE(test_server()->Start());
312 GURL main_url(test_server()->GetURL("files/site_per_process_main.html"));
313 NavigateToURL(shell(), main_url);
314
315 // It is safe to obtain the root frame tree node here, as it doesn't change.
316 FrameTreeNode* root =
317 static_cast<WebContentsImpl*>(shell()->web_contents())->
318 GetFrameTree()->root();
319
320 SitePerProcessWebContentsObserver observer(shell()->web_contents());
321
322 // Load same-site page into iframe.
323 FrameTreeNode* child = root->child_at(0);
324 GURL http_url(test_server()->GetURL("files/title1.html"));
325 NavigateFrameToURL(child, http_url);
326 EXPECT_EQ(http_url, observer.navigation_url());
327 EXPECT_TRUE(observer.navigation_succeeded());
328
329 // These must stay in scope with replace_host.
330 GURL::Replacements replace_host;
331 std::string foo_com("foo.com");
332
333 // Load cross-site page into iframe.
334 GURL cross_site_url(test_server()->GetURL("files/title2.html"));
335 replace_host.SetHostStr(foo_com);
336 cross_site_url = cross_site_url.ReplaceComponents(replace_host);
337 NavigateFrameToURL(root->child_at(0), cross_site_url);
338 EXPECT_EQ(cross_site_url, observer.navigation_url());
339 EXPECT_TRUE(observer.navigation_succeeded());
340
341 // Ensure that we have created a new process for the subframe.
342 ASSERT_EQ(1U, root->child_count());
343 SiteInstance* site_instance = child->current_frame_host()->GetSiteInstance();
344 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), site_instance);
345
346 // Emulate the main frame changing the src of the iframe such that it
347 // navigates cross-site.
348 cross_site_url = test_server()->GetURL("files/title3.html");
349 std::string bar_com("bar.com");
350 replace_host.SetHostStr(bar_com);
351 cross_site_url = cross_site_url.ReplaceComponents(replace_host);
352 NavigateIframeToURL(shell(), cross_site_url, "test");
353 EXPECT_EQ(cross_site_url, observer.navigation_url());
354 EXPECT_TRUE(observer.navigation_succeeded());
355
356 // Check again that a new process is created and is different from the
357 // top level one and the previous one.
358 ASSERT_EQ(1U, root->child_count());
359 child = root->child_at(0);
360 EXPECT_NE(shell()->web_contents()->GetSiteInstance(),
361 child->current_frame_host()->GetSiteInstance());
362 EXPECT_NE(site_instance,
363 child->current_frame_host()->GetSiteInstance());
364
365 // TODO(japhet): This currently causes an assertion in the renderer process.
366 // Enable when the assertion is fixed.
367 //NavigateFrameToURL(child, http_url);
368 //EXPECT_EQ(http_url, observer.navigation_url());
369 //EXPECT_TRUE(observer.navigation_succeeded());
370 //EXPECT_EQ(shell()->web_contents()->GetSiteInstance(),
371 // child->current_frame_host()->GetSiteInstance());
372 }
373
302 // Crash a subframe and ensures its children are cleared from the FrameTree. 374 // Crash a subframe and ensures its children are cleared from the FrameTree.
303 // See http://crbug.com/338508. 375 // See http://crbug.com/338508.
304 // TODO(creis): Disabled for flakiness; see http://crbug.com/405582. 376 // TODO(creis): Disabled for flakiness; see http://crbug.com/405582.
305 // TODO(creis): Enable this on Android when we can kill the process there. 377 // TODO(creis): Enable this on Android when we can kill the process there.
306 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DISABLED_CrashSubframe) { 378 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DISABLED_CrashSubframe) {
307 host_resolver()->AddRule("*", "127.0.0.1"); 379 host_resolver()->AddRule("*", "127.0.0.1");
308 ASSERT_TRUE(test_server()->Start()); 380 ASSERT_TRUE(test_server()->Start());
309 GURL main_url(test_server()->GetURL("files/site_per_process_main.html")); 381 GURL main_url(test_server()->GetURL("files/site_per_process_main.html"));
310 NavigateToURL(shell(), main_url); 382 NavigateToURL(shell(), main_url);
311 383
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 "server-redirect?" + client_redirect_http_url.spec())); 643 "server-redirect?" + client_redirect_http_url.spec()));
572 EXPECT_TRUE(NavigateIframeToURL(shell(), server_redirect_http_url, "test")); 644 EXPECT_TRUE(NavigateIframeToURL(shell(), server_redirect_http_url, "test"));
573 645
574 // DidFailProvisionalLoad when navigating to client_redirect_http_url. 646 // DidFailProvisionalLoad when navigating to client_redirect_http_url.
575 EXPECT_EQ(observer.navigation_url(), client_redirect_http_url); 647 EXPECT_EQ(observer.navigation_url(), client_redirect_http_url);
576 EXPECT_FALSE(observer.navigation_succeeded()); 648 EXPECT_FALSE(observer.navigation_succeeded());
577 } 649 }
578 } 650 }
579 651
580 } // namespace content 652 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_proxy_host.cc ('k') | content/renderer/render_frame_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698