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

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

Issue 782093002: Ensure that before creating proxy of site A, RVH of site A is initialized. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Create new RVH instead of re-using + Add test Created 6 years 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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 388
389 // Navigate back to the parent's origin and ensure we return to the 389 // Navigate back to the parent's origin and ensure we return to the
390 // parent's process. 390 // parent's process.
391 NavigateFrameToURL(child, http_url); 391 NavigateFrameToURL(child, http_url);
392 EXPECT_EQ(http_url, observer.navigation_url()); 392 EXPECT_EQ(http_url, observer.navigation_url());
393 EXPECT_TRUE(observer.navigation_succeeded()); 393 EXPECT_TRUE(observer.navigation_succeeded());
394 EXPECT_EQ(shell()->web_contents()->GetSiteInstance(), 394 EXPECT_EQ(shell()->web_contents()->GetSiteInstance(),
395 child->current_frame_host()->GetSiteInstance()); 395 child->current_frame_host()->GetSiteInstance());
396 } 396 }
397 397
398 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
nasko 2014/12/12 22:25:01 nit: Add a comment about what this case is testing
lazyboy 2014/12/23 22:03:11 Done.
399 NavigateRemoteFrameToAKilledSiteInstance) {
Charlie Reis 2014/12/12 19:18:31 nit: ToAKilledSiteInstance -> ToKilledProcess
lazyboy 2014/12/23 22:03:11 Done.
400 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html"));
401 NavigateToURL(shell(), main_url);
402
403 // It is safe to obtain the root frame tree node here, as it doesn't change.
404 FrameTreeNode* root =
405 static_cast<WebContentsImpl*>(shell()->web_contents())->
406 GetFrameTree()->root();
407
408 SitePerProcessWebContentsObserver observer(shell()->web_contents());
409
410 FrameTreeNode* first_child = root->child_at(0);
Charlie Reis 2014/12/12 19:18:31 Before this, we should ASSERT_EQ(2U, root->child_c
lazyboy 2014/12/23 22:03:11 Done.
411 // Load cross-site page into first iframe.
412 GURL url = embedded_test_server()->GetURL("foo.com", "/title2.html");
413 NavigateFrameToURL(first_child, url);
414 EXPECT_TRUE(observer.navigation_succeeded());
415 EXPECT_EQ(url, observer.navigation_url());
416
417 // Kill that cross-site renderer.
418 RenderProcessHost* child_process =
419 first_child->current_frame_host()->GetProcess();
420 {
Charlie Reis 2014/12/12 19:18:31 nit: No need for brace here if we're only doing on
lazyboy 2014/12/23 22:03:11 Done.
421 RenderProcessHostWatcher crash_observer(
422 child_process,
423 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
424 child_process->Shutdown(0, false);
425 crash_observer.Wait();
426 }
427
428 // Now navigate the second iframe to the same site as the first_child.
429 FrameTreeNode* second_child = root->child_at(1);
430 url = embedded_test_server()->GetURL("foo.com", "/title1.html");
nasko 2014/12/12 22:25:01 nit: It seems strange to navigate to title2 first
lazyboy 2014/12/23 22:03:11 Done.
431 NavigateFrameToURL(second_child, url);
432 EXPECT_TRUE(observer.navigation_succeeded());
433 EXPECT_EQ(url, observer.navigation_url());
434 }
435
398 // Crash a subframe and ensures its children are cleared from the FrameTree. 436 // Crash a subframe and ensures its children are cleared from the FrameTree.
399 // See http://crbug.com/338508. 437 // See http://crbug.com/338508.
400 // TODO(creis): Disabled for flakiness; see http://crbug.com/405582. 438 // TODO(creis): Disabled for flakiness; see http://crbug.com/405582.
401 // TODO(creis): Enable this on Android when we can kill the process there. 439 // TODO(creis): Enable this on Android when we can kill the process there.
402 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DISABLED_CrashSubframe) { 440 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DISABLED_CrashSubframe) {
403 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); 441 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html"));
404 NavigateToURL(shell(), main_url); 442 NavigateToURL(shell(), main_url);
405 443
406 StartFrameAtDataURL(); 444 StartFrameAtDataURL();
407 445
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 // Check that a new process is created and is different from the top one and 863 // Check that a new process is created and is different from the top one and
826 // the middle one. 864 // the middle one.
827 FrameTreeNode* bottom_child = root->child_at(0)->child_at(0); 865 FrameTreeNode* bottom_child = root->child_at(0)->child_at(0);
828 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), 866 EXPECT_NE(shell()->web_contents()->GetSiteInstance(),
829 bottom_child->current_frame_host()->GetSiteInstance()); 867 bottom_child->current_frame_host()->GetSiteInstance());
830 EXPECT_NE(root->child_at(0)->current_frame_host()->GetSiteInstance(), 868 EXPECT_NE(root->child_at(0)->current_frame_host()->GetSiteInstance(),
831 bottom_child->current_frame_host()->GetSiteInstance()); 869 bottom_child->current_frame_host()->GetSiteInstance());
832 } 870 }
833 871
834 } // namespace content 872 } // namespace content
OLDNEW
« content/browser/frame_host/frame_tree.cc ('K') | « content/browser/frame_host/frame_tree.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698