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

Side by Side Diff: chrome/browser/ui/browser_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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 <string> 5 #include <string>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); 539 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
540 EXPECT_TRUE(alert->IsValid()); 540 EXPECT_TRUE(alert->IsValid());
541 AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance(); 541 AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance();
542 EXPECT_TRUE(dialog_queue->HasActiveDialog()); 542 EXPECT_TRUE(dialog_queue->HasActiveDialog());
543 543
544 // Crash the renderer process and ensure the dialog is gone. 544 // Crash the renderer process and ensure the dialog is gone.
545 content::RenderProcessHost* child_process = contents->GetRenderProcessHost(); 545 content::RenderProcessHost* child_process = contents->GetRenderProcessHost();
546 content::RenderProcessHostWatcher crash_observer( 546 content::RenderProcessHostWatcher crash_observer(
547 child_process, 547 child_process,
548 content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); 548 content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
549 base::KillProcess(child_process->GetHandle(), 0, false); 549 child_process->Shutdown(0, false);
550 crash_observer.Wait(); 550 crash_observer.Wait();
551 EXPECT_FALSE(dialog_queue->HasActiveDialog()); 551 EXPECT_FALSE(dialog_queue->HasActiveDialog());
552 552
553 // Make sure subsequent navigations work. 553 // Make sure subsequent navigations work.
554 GURL url2("http://www.example.com/files/empty.html"); 554 GURL url2("http://www.example.com/files/empty.html");
555 ui_test_utils::NavigateToURL(browser(), url2); 555 ui_test_utils::NavigateToURL(browser(), url2);
556 } 556 }
557 557
558 // Make sure that dialogs opened by subframes are closed when the process dies. 558 // Make sure that dialogs opened by subframes are closed when the process dies.
559 // See http://crbug.com/366510. 559 // See http://crbug.com/366510.
560 IN_PROC_BROWSER_TEST_F(BrowserTest, SadTabCancelsSubframeDialogs) { 560 IN_PROC_BROWSER_TEST_F(BrowserTest, SadTabCancelsSubframeDialogs) {
561 // Navigate to an iframe that opens an alert dialog. 561 // Navigate to an iframe that opens an alert dialog.
562 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); 562 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
563 contents->GetMainFrame()->ExecuteJavaScript( 563 contents->GetMainFrame()->ExecuteJavaScript(
564 ASCIIToUTF16("window.location.href = 'data:text/html," 564 ASCIIToUTF16("window.location.href = 'data:text/html,"
565 "<iframe srcdoc=\"<script>alert(1)</script>\">'")); 565 "<iframe srcdoc=\"<script>alert(1)</script>\">'"));
566 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); 566 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
567 EXPECT_TRUE(alert->IsValid()); 567 EXPECT_TRUE(alert->IsValid());
568 AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance(); 568 AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance();
569 EXPECT_TRUE(dialog_queue->HasActiveDialog()); 569 EXPECT_TRUE(dialog_queue->HasActiveDialog());
570 570
571 // Crash the renderer process and ensure the dialog is gone. 571 // Crash the renderer process and ensure the dialog is gone.
572 content::RenderProcessHost* child_process = contents->GetRenderProcessHost(); 572 content::RenderProcessHost* child_process = contents->GetRenderProcessHost();
573 content::RenderProcessHostWatcher crash_observer( 573 content::RenderProcessHostWatcher crash_observer(
574 child_process, 574 child_process,
575 content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); 575 content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
576 base::KillProcess(child_process->GetHandle(), 0, false); 576 child_process->Shutdown(0, false);
577 crash_observer.Wait(); 577 crash_observer.Wait();
578 EXPECT_FALSE(dialog_queue->HasActiveDialog()); 578 EXPECT_FALSE(dialog_queue->HasActiveDialog());
579 579
580 // Make sure subsequent navigations work. 580 // Make sure subsequent navigations work.
581 GURL url2("data:text/html,foo"); 581 GURL url2("data:text/html,foo");
582 ui_test_utils::NavigateToURL(browser(), url2); 582 ui_test_utils::NavigateToURL(browser(), url2);
583 } 583 }
584 584
585 // Test for crbug.com/22004. Reloading a page with a before unload handler and 585 // Test for crbug.com/22004. Reloading a page with a before unload handler and
586 // then canceling the dialog should not leave the throbber spinning. 586 // then canceling the dialog should not leave the throbber spinning.
(...skipping 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2734 #endif 2734 #endif
2735 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); 2735 EXPECT_EQ(exp_commit_size, rwhv_commit_size2);
2736 EXPECT_EQ(exp_commit_size, wcv_commit_size2); 2736 EXPECT_EQ(exp_commit_size, wcv_commit_size2);
2737 gfx::Size exp_final_size(initial_wcv_size); 2737 gfx::Size exp_final_size(initial_wcv_size);
2738 exp_final_size.Enlarge(wcv_resize_insets.width(), 2738 exp_final_size.Enlarge(wcv_resize_insets.width(),
2739 wcv_resize_insets.height() + height_inset); 2739 wcv_resize_insets.height() + height_inset);
2740 EXPECT_EQ(exp_final_size, 2740 EXPECT_EQ(exp_final_size,
2741 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); 2741 web_contents->GetRenderWidgetHostView()->GetViewBounds().size());
2742 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); 2742 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size());
2743 } 2743 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc ('k') | chrome/browser/ui/views/hung_renderer_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698