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

Unified Diff: chrome/browser/browser_browsertest.cc

Issue 256015: Stops the throbber from spinning if the user cancels a beforeunload dialog,... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 3 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 | chrome/browser/renderer_host/render_view_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browser_browsertest.cc
===================================================================
--- chrome/browser/browser_browsertest.cc (revision 27429)
+++ chrome/browser/browser_browsertest.cc (working copy)
@@ -18,6 +18,11 @@
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
+const std::string BEFORE_UNLOAD_HTML =
+ "<html><head><title>beforeunload</title></head><body>"
+ "<script>window.onbeforeunload=function(e){return 'foo'}</script>"
+ "</body></html>";
+
namespace {
// Given a page title, returns the expected window caption string.
@@ -138,3 +143,21 @@
EXPECT_LE(CountRenderProcessHosts(), 23);
}
}
+
+// 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) {
+ GURL url("data:text/html," + BEFORE_UNLOAD_HTML);
+ ui_test_utils::NavigateToURL(browser(), url);
+
+ // Navigate to another page, but click cancel in the dialog. Make sure that
+ // the throbber stops spinning.
+ browser()->Reload();
+ AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
+ alert->CloseModalDialog();
+ EXPECT_FALSE(browser()->GetSelectedTabContents()->is_loading());
+
+ // Clear the beforeunload handler so the test can easily exit.
+ browser()->GetSelectedTabContents()->render_view_host()->
+ ExecuteJavascriptInWebFrame(L"", L"onbeforeunload=null;");
+}
« no previous file with comments | « no previous file | chrome/browser/renderer_host/render_view_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698