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

Unified Diff: chrome/browser/unload_uitest.cc

Issue 6794056: Revert 80472 - GTTF: Detect browser crashes on shutdown in UI tests.Previously the automation fra... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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 | « chrome/browser/process_singleton_linux_uitest.cc ('k') | chrome/common/service_process_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/unload_uitest.cc
===================================================================
--- chrome/browser/unload_uitest.cc (revision 80485)
+++ chrome/browser/unload_uitest.cc (working copy)
@@ -103,13 +103,25 @@
UITest::SetUp();
}
+ void WaitForBrowserClosed() {
+ const int kCheckDelayMs = 100;
+ for (int max_wait_time = TestTimeouts::action_max_timeout_ms();
+ max_wait_time > 0; max_wait_time -= kCheckDelayMs) {
+ CrashAwareSleep(kCheckDelayMs);
+ if (!IsBrowserRunning())
+ break;
+ }
+
+ EXPECT_FALSE(IsBrowserRunning());
+ }
+
void CheckTitle(const std::wstring& expected_title) {
const int kCheckDelayMs = 100;
for (int max_wait_time = TestTimeouts::action_max_timeout_ms();
max_wait_time > 0; max_wait_time -= kCheckDelayMs) {
+ CrashAwareSleep(kCheckDelayMs);
if (expected_title == GetActiveTabTitle())
break;
- base::PlatformThread::Sleep(kCheckDelayMs);
}
EXPECT_EQ(expected_title, GetActiveTabTitle());
@@ -289,11 +301,7 @@
CloseBrowserAsync(browser.get());
ClickModalDialogButton(ui::MessageBoxFlags::DIALOGBUTTON_OK);
-
- int exit_code = -1;
- ASSERT_TRUE(launcher_->WaitForBrowserProcessToQuit(
- TestTimeouts::action_max_timeout_ms(), &exit_code));
- EXPECT_EQ(0, exit_code); // Expect a clean shutown.
+ WaitForBrowserClosed();
}
// Tests closing the browser with a beforeunload handler and clicking
@@ -305,19 +313,14 @@
CloseBrowserAsync(browser.get());
ClickModalDialogButton(ui::MessageBoxFlags::DIALOGBUTTON_CANCEL);
-
// There's no real graceful way to wait for something _not_ to happen, so
// we just wait a short period.
- base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms());
+ CrashAwareSleep(500);
ASSERT_TRUE(IsBrowserRunning());
CloseBrowserAsync(browser.get());
ClickModalDialogButton(ui::MessageBoxFlags::DIALOGBUTTON_OK);
-
- int exit_code = -1;
- ASSERT_TRUE(launcher_->WaitForBrowserProcessToQuit(
- TestTimeouts::action_max_timeout_ms(), &exit_code));
- EXPECT_EQ(0, exit_code); // Expect a clean shutdown.
+ WaitForBrowserClosed();
}
#if defined(OS_LINUX)
@@ -339,11 +342,7 @@
CloseBrowserAsync(browser.get());
ClickModalDialogButton(ui::MessageBoxFlags::DIALOGBUTTON_OK);
-
- int exit_code = -1;
- ASSERT_TRUE(launcher_->WaitForBrowserProcessToQuit(
- TestTimeouts::action_max_timeout_ms(), &exit_code));
- EXPECT_EQ(0, exit_code); // Expect a clean shutdown.
+ WaitForBrowserClosed();
}
// Tests closing the browser with a beforeunload handler that takes
« no previous file with comments | « chrome/browser/process_singleton_linux_uitest.cc ('k') | chrome/common/service_process_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698