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

Unified Diff: chrome/browser/devtools/devtools_sanity_browsertest.cc

Issue 2780343002: Always disable the beforeunload timer when injecting the beforeunload method. (Closed)
Patch Set: fix Created 3 years, 9 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/devtools/devtools_sanity_browsertest.cc
diff --git a/chrome/browser/devtools/devtools_sanity_browsertest.cc b/chrome/browser/devtools/devtools_sanity_browsertest.cc
index 53a646e337114adfb5e1c97d7dbaf44d02dbf1c6..174aacf1ad49da205fd8e5ca5ed293daa3e4a437 100644
--- a/chrome/browser/devtools/devtools_sanity_browsertest.cc
+++ b/chrome/browser/devtools/devtools_sanity_browsertest.cc
@@ -382,6 +382,9 @@ class DevToolsBeforeUnloadTest: public DevToolsSanityTest {
ASSERT_TRUE(content::ExecuteScript(web_contents->GetRenderViewHost(),
"window.addEventListener('beforeunload',"
"function(event) { event.returnValue = 'Foo'; });"));
+ // Disable the hang monitor, otherwise there will be a race between the
+ // beforeunload dialog and the beforeunload hang timer.
+ web_contents->GetMainFrame()->DisableBeforeUnloadHangMonitorForTesting();
}
void RunBeforeUnloadSanityTest(bool is_docked,
@@ -393,9 +396,6 @@ class DevToolsBeforeUnloadTest: public DevToolsSanityTest {
DevToolsWindowTesting::Get(window_)->
SetCloseCallback(runner->QuitClosure());
InjectBeforeUnloadListener(main_web_contents());
- main_web_contents()
- ->GetMainFrame()
- ->DisableBeforeUnloadHangMonitorForTesting();
{
DevToolsWindowBeforeUnloadObserver before_unload_observer(window_);
close_method.Run();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698