diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-13 00:42:45 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-13 00:42:45 +0000 |
commit | ce3e10da99425b8f05b4bd220a3cf185c97af632 (patch) | |
tree | 2198cf243602684789a501d019eea443818fd7b2 /chrome/browser/unload_browsertest.cc | |
parent | 1cb05dbbcafd3f35999606af6c8316058ce7b93a (diff) | |
download | chromium_src-ce3e10da99425b8f05b4bd220a3cf185c97af632.zip chromium_src-ce3e10da99425b8f05b4bd220a3cf185c97af632.tar.gz chromium_src-ce3e10da99425b8f05b4bd220a3cf185c97af632.tar.bz2 |
Fix flakiness in unload browser test. The problem is that the sudden termination IPC comes after loading stop, so it's a race condition whether it's handled before we close the window and wait for the prompt. Expliclity set it if it's not set by the time the tests run.
BUG=123110
Review URL: https://chromiumcodereview.appspot.com/10071029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132110 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/unload_browsertest.cc')
-rw-r--r-- | chrome/browser/unload_browsertest.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/chrome/browser/unload_browsertest.cc b/chrome/browser/unload_browsertest.cc index 62f1640..56c7657 100644 --- a/chrome/browser/unload_browsertest.cc +++ b/chrome/browser/unload_browsertest.cc @@ -7,6 +7,7 @@ #endif #include "base/command_line.h" +#include "base/logging.h" #include "base/process_util.h" #include "base/utf_string_conversions.h" #include "chrome/browser/net/url_request_mock_util.h" @@ -20,6 +21,7 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/render_process_host.h" #include "content/public/browser/web_contents.h" #include "content/test/net/url_request_mock_http_job.h" #include "net/url_request/url_request_test_util.h" @@ -132,6 +134,14 @@ class UnloadTest : public InProcessBrowserTest { const char* expected_title) { ui_test_utils::NavigateToURL(browser(), GURL("data:text/html," + html_content)); + content::RenderProcessHost* process = + browser()->GetSelectedWebContents()->GetRenderProcessHost(); + if (html_content.find("unload=") != std::string::npos && + process->SuddenTerminationAllowed()) { + LOG(INFO) << "Explicitly unsetting sudden termination because IPC didn't " + "arrive yet"; + process->SetSuddenTerminationAllowed(false); + } CheckTitle(expected_title); } |