| Index: chrome/browser/unload_browsertest.cc
|
| diff --git a/chrome/browser/unload_browsertest.cc b/chrome/browser/unload_browsertest.cc
|
| index 2af1a45082547fa5dad650df28f6867d2e6445cd..d1658351bd69b3bf6dcded60f037a3c97380c932 100644
|
| --- a/chrome/browser/unload_browsertest.cc
|
| +++ b/chrome/browser/unload_browsertest.cc
|
| @@ -24,6 +24,7 @@
|
| #include "components/app_modal/native_app_modal_dialog.h"
|
| #include "content/public/browser/browser_thread.h"
|
| #include "content/public/browser/notification_service.h"
|
| +#include "content/public/browser/render_frame_host.h"
|
| #include "content/public/browser/web_contents.h"
|
| #include "content/public/common/content_switches.h"
|
| #include "content/public/test/browser_test_utils.h"
|
| @@ -278,6 +279,13 @@ IN_PROC_BROWSER_TEST_F(UnloadTest, DISABLED_BrowserCloseUnload) {
|
| // OK in the beforeunload confirm dialog.
|
| IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserCloseBeforeUnloadOK) {
|
| NavigateToDataURL(BEFORE_UNLOAD_HTML, "beforeunload");
|
| + // Disable the hang monitor, otherwise there will be a race between the
|
| + // beforeunload dialog and the beforeunload hang timer.
|
| + browser()
|
| + ->tab_strip_model()
|
| + ->GetActiveWebContents()
|
| + ->GetMainFrame()
|
| + ->DisableBeforeUnloadHangMonitorForTesting();
|
|
|
| content::WindowedNotificationObserver window_observer(
|
| chrome::NOTIFICATION_BROWSER_CLOSED,
|
| @@ -292,6 +300,14 @@ IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserCloseBeforeUnloadOK) {
|
| // If this test flakes, reopen http://crbug.com/123110
|
| IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserCloseBeforeUnloadCancel) {
|
| NavigateToDataURL(BEFORE_UNLOAD_HTML, "beforeunload");
|
| + // Disable the hang monitor, otherwise there will be a race between the
|
| + // beforeunload dialog and the beforeunload hang timer.
|
| + browser()
|
| + ->tab_strip_model()
|
| + ->GetActiveWebContents()
|
| + ->GetMainFrame()
|
| + ->DisableBeforeUnloadHangMonitorForTesting();
|
| +
|
| chrome::CloseWindow(browser());
|
|
|
| // We wait for the title to change after cancelling the closure of browser
|
| @@ -337,6 +353,13 @@ IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserListCloseNoUnloadListeners) {
|
| // beforeunload handler and clicking Leave in the beforeunload confirm dialog.
|
| IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserListCloseBeforeUnloadOK) {
|
| NavigateToDataURL(BEFORE_UNLOAD_HTML, "beforeunload");
|
| + // Disable the hang monitor, otherwise there will be a race between the
|
| + // beforeunload dialog and the beforeunload hang timer.
|
| + browser()
|
| + ->tab_strip_model()
|
| + ->GetActiveWebContents()
|
| + ->GetMainFrame()
|
| + ->DisableBeforeUnloadHangMonitorForTesting();
|
|
|
| content::WindowedNotificationObserver window_observer(
|
| chrome::NOTIFICATION_BROWSER_CLOSED,
|
| @@ -357,6 +380,13 @@ IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserListCloseBeforeUnloadOK) {
|
| // beforeunload handler and clicking Stay in the beforeunload confirm dialog.
|
| IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserListCloseBeforeUnloadCancel) {
|
| NavigateToDataURL(BEFORE_UNLOAD_HTML, "beforeunload");
|
| + // Disable the hang monitor, otherwise there will be a race between the
|
| + // beforeunload dialog and the beforeunload hang timer.
|
| + browser()
|
| + ->tab_strip_model()
|
| + ->GetActiveWebContents()
|
| + ->GetMainFrame()
|
| + ->DisableBeforeUnloadHangMonitorForTesting();
|
|
|
| UnloadResults unload_results;
|
| BrowserList::CloseAllBrowsersWithProfile(
|
| @@ -392,6 +422,13 @@ IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserListCloseBeforeUnloadCancel) {
|
| // beforeunload handler and clicking Leave in the beforeunload confirm dialog.
|
| IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserListDoubleCloseBeforeUnloadOK) {
|
| NavigateToDataURL(BEFORE_UNLOAD_HTML, "beforeunload");
|
| + // Disable the hang monitor, otherwise there will be a race between the
|
| + // beforeunload dialog and the beforeunload hang timer.
|
| + browser()
|
| + ->tab_strip_model()
|
| + ->GetActiveWebContents()
|
| + ->GetMainFrame()
|
| + ->DisableBeforeUnloadHangMonitorForTesting();
|
|
|
| content::WindowedNotificationObserver window_observer(
|
| chrome::NOTIFICATION_BROWSER_CLOSED,
|
| @@ -417,6 +454,13 @@ IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserListDoubleCloseBeforeUnloadOK) {
|
| // beforeunload handler and clicking Stay in the beforeunload confirm dialog.
|
| IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserListDoubleCloseBeforeUnloadCancel) {
|
| NavigateToDataURL(BEFORE_UNLOAD_HTML, "beforeunload");
|
| + // Disable the hang monitor, otherwise there will be a race between the
|
| + // beforeunload dialog and the beforeunload hang timer.
|
| + browser()
|
| + ->tab_strip_model()
|
| + ->GetActiveWebContents()
|
| + ->GetMainFrame()
|
| + ->DisableBeforeUnloadHangMonitorForTesting();
|
|
|
| UnloadResults unload_results;
|
| BrowserList::CloseAllBrowsersWithProfile(
|
| @@ -467,6 +511,13 @@ IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserTerminateBeforeUnload) {
|
| // If this flakes, use http://crbug.com/32615 and http://crbug.com/45675
|
| IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserCloseWithInnerFocusedFrame) {
|
| NavigateToDataURL(INNER_FRAME_WITH_FOCUS_HTML, "innerframewithfocus");
|
| + // Disable the hang monitor, otherwise there will be a race between the
|
| + // beforeunload dialog and the beforeunload hang timer.
|
| + browser()
|
| + ->tab_strip_model()
|
| + ->GetActiveWebContents()
|
| + ->GetMainFrame()
|
| + ->DisableBeforeUnloadHangMonitorForTesting();
|
|
|
| content::WindowedNotificationObserver window_observer(
|
| chrome::NOTIFICATION_BROWSER_CLOSED,
|
|
|