Index: content/browser/browser_side_navigation_browsertest.cc |
diff --git a/content/browser/browser_side_navigation_browsertest.cc b/content/browser/browser_side_navigation_browsertest.cc |
index b6d27f09f82400ba04e8df88c43b13216d84d579..0a5d1f354b44fcf72fbc997ede7bfa7409d8861c 100644 |
--- a/content/browser/browser_side_navigation_browsertest.cc |
+++ b/content/browser/browser_side_navigation_browsertest.cc |
@@ -9,6 +9,7 @@ |
#include "base/strings/utf_string_conversions.h" |
#include "content/browser/web_contents/web_contents_impl.h" |
#include "content/common/site_isolation_policy.h" |
+#include "content/public/browser/notification_types.h" |
#include "content/public/browser/web_contents.h" |
#include "content/public/common/content_switches.h" |
#include "content/public/common/url_constants.h" |
@@ -271,4 +272,16 @@ IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, |
->IsViewSourceMode()); |
} |
+// Ensure that closing a page by running its beforeunload handler doesn't hang |
+// if there's an ongoing navigation. |
+IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, |
+ UnloadDuringNavigation) { |
+ content::WindowedNotificationObserver close_observer( |
+ content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
+ content::Source<content::WebContents>(shell()->web_contents())); |
+ shell()->LoadURL(GURL("chrome://resources/css/tabs.css")); |
+ shell()->web_contents()->DispatchBeforeUnload(); |
+ close_observer.Wait(); |
+} |
+ |
} // namespace content |