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

Unified Diff: chrome/browser/ui/browser_browsertest.cc

Issue 177123002: Clear any open dialogs when the renderer process goes away. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_browsertest.cc
diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc
index 6b834a19e33280e58261c936d98e24ad836d2962..04903b8086a2ed4134c3ff764ee060175dacd406 100644
--- a/chrome/browser/ui/browser_browsertest.cc
+++ b/chrome/browser/ui/browser_browsertest.cc
@@ -497,6 +497,38 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CrossProcessNavCancelsDialogs) {
EXPECT_FALSE(contents->GetRenderProcessHost()->IgnoreInputEvents());
}
+// Make sure that dialogs are closed after a renderer process dies, and that
+// subsequent navigations work. See http://crbug/com/343265.
+IN_PROC_BROWSER_TEST_F(BrowserTest, SadTabCancelsDialogs) {
+ ASSERT_TRUE(test_server()->Start());
+ host_resolver()->AddRule("www.example.com", "127.0.0.1");
+ GURL beforeunload_url(test_server()->GetURL("files/beforeunload.html"));
+ ui_test_utils::NavigateToURL(browser(), beforeunload_url);
+
+ // Start a navigation to trigger the beforeunload dialog.
+ WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
+ contents->GetRenderViewHost()->ExecuteJavascriptInWebFrame(
+ base::string16(),
+ ASCIIToUTF16("window.location.href = 'data:text/html,foo'"));
+ AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
+ EXPECT_TRUE(alert->IsValid());
+ AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance();
+ EXPECT_TRUE(dialog_queue->HasActiveDialog());
+
+ // Crash the renderer process and ensure the dialog is gone.
+ content::RenderProcessHost* child_process = contents->GetRenderProcessHost();
+ content::RenderProcessHostWatcher crash_observer(
+ child_process,
+ content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
+ base::KillProcess(child_process->GetHandle(), 0, false);
+ crash_observer.Wait();
+ EXPECT_FALSE(dialog_queue->HasActiveDialog());
+
+ // Make sure subsequent navigations work.
+ GURL url2("http://www.example.com/files/empty.html");
+ ui_test_utils::NavigateToURL(browser(), url2);
+}
+
// Test for crbug.com/22004. Reloading a page with a before unload handler and
// then canceling the dialog should not leave the throbber spinning.
IN_PROC_BROWSER_TEST_F(BrowserTest, ReloadThenCancelBeforeUnload) {
« no previous file with comments | « no previous file | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698