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

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

Issue 740813004: Use StopChildProcess instead of base::KillProcess to kill a renderer process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comments 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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 child->current_frame_host()->render_view_host()->IsRenderViewLive()); 380 child->current_frame_host()->render_view_host()->IsRenderViewLive());
381 EXPECT_TRUE(child->current_frame_host()->IsRenderFrameLive()); 381 EXPECT_TRUE(child->current_frame_host()->IsRenderFrameLive());
382 382
383 // Crash the subframe process. 383 // Crash the subframe process.
384 RenderProcessHost* root_process = root->current_frame_host()->GetProcess(); 384 RenderProcessHost* root_process = root->current_frame_host()->GetProcess();
385 RenderProcessHost* child_process = child->current_frame_host()->GetProcess(); 385 RenderProcessHost* child_process = child->current_frame_host()->GetProcess();
386 { 386 {
387 RenderProcessHostWatcher crash_observer( 387 RenderProcessHostWatcher crash_observer(
388 child_process, 388 child_process,
389 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); 389 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
390 base::KillProcess(child_process->GetHandle(), 0, false); 390 child_process->Shutdown(0, false);
391 crash_observer.Wait(); 391 crash_observer.Wait();
392 } 392 }
393 393
394 // Ensure that the child frame still exists but has been cleared. 394 // Ensure that the child frame still exists but has been cleared.
395 EXPECT_EQ(1U, root->child_count()); 395 EXPECT_EQ(1U, root->child_count());
396 EXPECT_EQ(main_url, root->current_url()); 396 EXPECT_EQ(main_url, root->current_url());
397 EXPECT_EQ(GURL(), child->current_url()); 397 EXPECT_EQ(GURL(), child->current_url());
398 398
399 EXPECT_FALSE( 399 EXPECT_FALSE(
400 child->current_frame_host()->render_view_host()->IsRenderViewLive()); 400 child->current_frame_host()->render_view_host()->IsRenderViewLive());
401 EXPECT_FALSE(child->current_frame_host()->IsRenderFrameLive()); 401 EXPECT_FALSE(child->current_frame_host()->IsRenderFrameLive());
402 EXPECT_FALSE(child->current_frame_host()->render_frame_created_); 402 EXPECT_FALSE(child->current_frame_host()->render_frame_created_);
403 403
404 // Now crash the top-level page to clear the child frame. 404 // Now crash the top-level page to clear the child frame.
405 { 405 {
406 RenderProcessHostWatcher crash_observer( 406 RenderProcessHostWatcher crash_observer(
407 root_process, 407 root_process,
408 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); 408 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
409 base::KillProcess(root_process->GetHandle(), 0, false); 409 root_process->Shutdown(0, false);
410 crash_observer.Wait(); 410 crash_observer.Wait();
411 } 411 }
412 EXPECT_EQ(0U, root->child_count()); 412 EXPECT_EQ(0U, root->child_count());
413 EXPECT_EQ(GURL(), root->current_url()); 413 EXPECT_EQ(GURL(), root->current_url());
414 } 414 }
415 415
416 // TODO(nasko): Disable this test until out-of-process iframes is ready and the 416 // TODO(nasko): Disable this test until out-of-process iframes is ready and the
417 // security checks are back in place. 417 // security checks are back in place.
418 // TODO(creis): Replace SpawnedTestServer with host_resolver to get test to run 418 // TODO(creis): Replace SpawnedTestServer with host_resolver to get test to run
419 // on Android (http://crbug.com/187570). 419 // on Android (http://crbug.com/187570).
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 } 729 }
730 730
731 navigation_observer.Wait(); 731 navigation_observer.Wait();
732 EXPECT_TRUE(observer.navigation_succeeded()); 732 EXPECT_TRUE(observer.navigation_succeeded());
733 EXPECT_EQ(cross_site_url, observer.navigation_url()); 733 EXPECT_EQ(cross_site_url, observer.navigation_url());
734 EXPECT_EQ(0U, child->child_count()); 734 EXPECT_EQ(0U, child->child_count());
735 } 735 }
736 } 736 }
737 737
738 } // namespace content 738 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/security_exploit_browsertest.cc ('k') | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698