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

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

Issue 172063002: Unify frame IDs with RenderFrameHost routing IDs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix type Created 6 years, 10 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
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 "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "content/browser/frame_host/frame_tree.h" 8 #include "content/browser/frame_host/frame_tree.h"
9 #include "content/browser/loader/resource_dispatcher_host_impl.h" 9 #include "content/browser/loader/resource_dispatcher_host_impl.h"
10 #include "content/browser/renderer_host/render_view_host_impl.h" 10 #include "content/browser/renderer_host/render_view_host_impl.h"
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 replace_host.SetHostStr(foo_com); 476 replace_host.SetHostStr(foo_com);
477 cross_site_url = cross_site_url.ReplaceComponents(replace_host); 477 cross_site_url = cross_site_url.ReplaceComponents(replace_host);
478 EXPECT_TRUE(NavigateIframeToURL(shell(), cross_site_url, "test")); 478 EXPECT_TRUE(NavigateIframeToURL(shell(), cross_site_url, "test"));
479 479
480 // Check the subframe process. 480 // Check the subframe process.
481 FrameTreeNode* root = 481 FrameTreeNode* root =
482 static_cast<WebContentsImpl*>(shell()->web_contents())-> 482 static_cast<WebContentsImpl*>(shell()->web_contents())->
483 GetFrameTree()->root(); 483 GetFrameTree()->root();
484 ASSERT_EQ(1U, root->child_count()); 484 ASSERT_EQ(1U, root->child_count());
485 FrameTreeNode* child = root->child_at(0); 485 FrameTreeNode* child = root->child_at(0);
486 EXPECT_NE(FrameTreeNode::kInvalidFrameId, root->frame_id()); 486 EXPECT_EQ(main_url, root->current_url());
487 EXPECT_NE(FrameTreeNode::kInvalidFrameId, root->child_at(0)->frame_id()); 487 EXPECT_EQ(cross_site_url, child->current_url());
488 488
489 // Crash the subframe process. 489 // Crash the subframe process.
490 RenderProcessHost* root_process = root->current_frame_host()->GetProcess(); 490 RenderProcessHost* root_process = root->current_frame_host()->GetProcess();
491 RenderProcessHost* child_process = child->current_frame_host()->GetProcess(); 491 RenderProcessHost* child_process = child->current_frame_host()->GetProcess();
492 { 492 {
493 RenderProcessHostWatcher crash_observer( 493 RenderProcessHostWatcher crash_observer(
494 child_process, 494 child_process,
495 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); 495 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
496 base::KillProcess(child_process->GetHandle(), 0, false); 496 base::KillProcess(child_process->GetHandle(), 0, false);
497 crash_observer.Wait(); 497 crash_observer.Wait();
498 } 498 }
499 499
500 // Ensure that the child frame still exists but has been cleared. 500 // Ensure that the child frame still exists but has been cleared.
501 EXPECT_EQ(1U, root->child_count()); 501 EXPECT_EQ(1U, root->child_count());
502 EXPECT_EQ(FrameTreeNode::kInvalidFrameId, root->child_at(0)->frame_id()); 502 EXPECT_EQ(main_url, root->current_url());
503 EXPECT_EQ(GURL(), child->current_url());
503 504
504 // Now crash the top-level page to clear the child frame. 505 // Now crash the top-level page to clear the child frame.
505 { 506 {
506 RenderProcessHostWatcher crash_observer( 507 RenderProcessHostWatcher crash_observer(
507 root_process, 508 root_process,
508 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); 509 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
509 base::KillProcess(root_process->GetHandle(), 0, false); 510 base::KillProcess(root_process->GetHandle(), 0, false);
510 crash_observer.Wait(); 511 crash_observer.Wait();
511 } 512 }
512 EXPECT_EQ(0U, root->child_count()); 513 EXPECT_EQ(0U, root->child_count());
513 EXPECT_EQ(FrameTreeNode::kInvalidFrameId, root->frame_id()); 514 EXPECT_EQ(GURL(), root->current_url());
514 } 515 }
515 516
516 // TODO(nasko): Disable this test until out-of-process iframes is ready and the 517 // TODO(nasko): Disable this test until out-of-process iframes is ready and the
517 // security checks are back in place. 518 // security checks are back in place.
518 // TODO(creis): Replace SpawnedTestServer with host_resolver to get test to run 519 // TODO(creis): Replace SpawnedTestServer with host_resolver to get test to run
519 // on Android (http://crbug.com/187570). 520 // on Android (http://crbug.com/187570).
520 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, 521 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
521 DISABLED_CrossSiteIframeRedirectOnce) { 522 DISABLED_CrossSiteIframeRedirectOnce) {
522 ASSERT_TRUE(test_server()->Start()); 523 ASSERT_TRUE(test_server()->Start());
523 net::SpawnedTestServer https_server( 524 net::SpawnedTestServer https_server(
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 EXPECT_EQ(0, controller.GetCurrentEntryIndex()); 935 EXPECT_EQ(0, controller.GetCurrentEntryIndex());
935 EXPECT_EQ(url1, controller.GetEntryAtIndex(0)->GetURL()); 936 EXPECT_EQ(url1, controller.GetEntryAtIndex(0)->GetURL());
936 937
937 // Make sure the request for url2 did not complete. 938 // Make sure the request for url2 did not complete.
938 EXPECT_FALSE(tracking_delegate().WaitForTrackedURLAndGetCompleted()); 939 EXPECT_FALSE(tracking_delegate().WaitForTrackedURLAndGetCompleted());
939 940
940 shell()->web_contents()->SetDelegate(old_delegate); 941 shell()->web_contents()->SetDelegate(old_delegate);
941 } 942 }
942 943
943 } // namespace content 944 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/security_exploit_browsertest.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