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

Unified Diff: chrome/browser/unload_uitest.cc

Issue 6689014: GTTF: Detect browser crashes on shutdown in UI tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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
Index: chrome/browser/unload_uitest.cc
===================================================================
--- chrome/browser/unload_uitest.cc (revision 80488)
+++ chrome/browser/unload_uitest.cc (working copy)
@@ -103,25 +103,13 @@
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());
@@ -301,7 +289,11 @@
CloseBrowserAsync(browser.get());
ClickModalDialogButton(ui::MessageBoxFlags::DIALOGBUTTON_OK);
- WaitForBrowserClosed();
+
+ int exit_code = -1;
+ ASSERT_TRUE(launcher_->WaitForBrowserProcessToQuit(
+ TestTimeouts::action_max_timeout_ms(), &exit_code));
+ EXPECT_EQ(0, exit_code); // Expect a clean shutown.
}
// Tests closing the browser with a beforeunload handler and clicking
@@ -313,14 +305,19 @@
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.
- CrashAwareSleep(500);
+ base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms());
ASSERT_TRUE(IsBrowserRunning());
CloseBrowserAsync(browser.get());
ClickModalDialogButton(ui::MessageBoxFlags::DIALOGBUTTON_OK);
- WaitForBrowserClosed();
+
+ int exit_code = -1;
+ ASSERT_TRUE(launcher_->WaitForBrowserProcessToQuit(
+ TestTimeouts::action_max_timeout_ms(), &exit_code));
+ EXPECT_EQ(0, exit_code); // Expect a clean shutdown.
}
#if defined(OS_LINUX)
@@ -342,7 +339,11 @@
CloseBrowserAsync(browser.get());
ClickModalDialogButton(ui::MessageBoxFlags::DIALOGBUTTON_OK);
- WaitForBrowserClosed();
+
+ int exit_code = -1;
+ ASSERT_TRUE(launcher_->WaitForBrowserProcessToQuit(
+ TestTimeouts::action_max_timeout_ms(), &exit_code));
+ EXPECT_EQ(0, exit_code); // Expect a clean shutdown.
}
// Tests closing the browser with a beforeunload handler that takes

Powered by Google App Engine
This is Rietveld 408576698