summaryrefslogtreecommitdiffstats
path: root/chrome/browser/unload_uitest.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-27 19:12:59 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-27 19:12:59 +0000
commite658e759634b2e86a89431b786f756f472478586 (patch)
tree8ee2872a71265b8bd4d7194cc02d17d14fcf313d /chrome/browser/unload_uitest.cc
parentad24711d3c1dbb2fbf332d112305ac51ac2e427d (diff)
downloadchromium_src-e658e759634b2e86a89431b786f756f472478586.zip
chromium_src-e658e759634b2e86a89431b786f756f472478586.tar.gz
chromium_src-e658e759634b2e86a89431b786f756f472478586.tar.bz2
Enable passing unload tests on Linux.
Also make one execute significantly faster. BUG=45021 TEST=they pass consistently Review URL: http://codereview.chromium.org/2296001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48415 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/unload_uitest.cc')
-rw-r--r--chrome/browser/unload_uitest.cc35
1 files changed, 13 insertions, 22 deletions
diff --git a/chrome/browser/unload_uitest.cc b/chrome/browser/unload_uitest.cc
index 688576a..e0185c8 100644
--- a/chrome/browser/unload_uitest.cc
+++ b/chrome/browser/unload_uitest.cc
@@ -105,21 +105,21 @@ class UnloadTest : public UITest {
void WaitForBrowserClosed() {
const int kCheckDelayMs = 100;
- int max_wait_time = action_max_timeout_ms();
- while (max_wait_time > 0) {
- max_wait_time -= kCheckDelayMs;
- PlatformThread::Sleep(kCheckDelayMs);
+ for (int max_wait_time = 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;
- int max_wait_time = action_max_timeout_ms();
- while (max_wait_time > 0) {
- max_wait_time -= kCheckDelayMs;
- PlatformThread::Sleep(kCheckDelayMs);
+ for (int max_wait_time = action_max_timeout_ms();
+ max_wait_time > 0; max_wait_time -= kCheckDelayMs) {
+ CrashAwareSleep(kCheckDelayMs);
if (expected_title == GetActiveTabTitle())
break;
}
@@ -285,13 +285,7 @@ TEST_F(UnloadTest, BrowserCloseUnload) {
LoadUrlAndQuitBrowser(UNLOAD_HTML, L"unload");
}
-#if defined(OS_LINUX)
-// Hangs on Linux: http://crbug.com/45021
-#define BrowserCloseBeforeUnloadOK DISABLED_BrowserCloseBeforeUnloadOK
-#define BrowserCloseBeforeUnloadCancel DISABLED_BrowserCloseBeforeUnloadCancel
-#define BrowserCloseWithInnerFocusedFrame \
- DISABLED_BrowserCloseWithInnerFocusedFrame
-#elif defined(OS_MACOSX)
+#if defined(OS_MACOSX)
// ClickModalDialogButton doesn't work on Mac: http://crbug.com/45031
#define BrowserCloseBeforeUnloadOK DISABLED_BrowserCloseBeforeUnloadOK
#define BrowserCloseBeforeUnloadCancel DISABLED_BrowserCloseBeforeUnloadCancel
@@ -308,7 +302,6 @@ TEST_F(UnloadTest, BrowserCloseBeforeUnloadOK) {
CloseBrowserAsync(browser.get());
ClickModalDialogButton(MessageBoxFlags::DIALOGBUTTON_OK);
WaitForBrowserClosed();
- EXPECT_FALSE(IsBrowserRunning());
}
// Tests closing the browser with a beforeunload handler and clicking
@@ -320,13 +313,14 @@ TEST_F(UnloadTest, BrowserCloseBeforeUnloadCancel) {
CloseBrowserAsync(browser.get());
ClickModalDialogButton(MessageBoxFlags::DIALOGBUTTON_CANCEL);
- WaitForBrowserClosed();
- EXPECT_TRUE(IsBrowserRunning());
+ // There's no real graceful way to wait for something _not_ to happen, so
+ // we just wait a short period.
+ CrashAwareSleep(500);
+ ASSERT_TRUE(IsBrowserRunning());
CloseBrowserAsync(browser.get());
ClickModalDialogButton(MessageBoxFlags::DIALOGBUTTON_OK);
WaitForBrowserClosed();
- EXPECT_FALSE(IsBrowserRunning());
}
// Tests closing the browser and clicking OK in the beforeunload confirm dialog
@@ -340,7 +334,6 @@ TEST_F(UnloadTest, BrowserCloseWithInnerFocusedFrame) {
CloseBrowserAsync(browser.get());
ClickModalDialogButton(MessageBoxFlags::DIALOGBUTTON_OK);
WaitForBrowserClosed();
- EXPECT_FALSE(IsBrowserRunning());
}
// Tests closing the browser with a beforeunload handler that takes
@@ -350,8 +343,6 @@ TEST_F(UnloadTest, BrowserCloseTwoSecondBeforeUnload) {
L"twosecondbeforeunload");
}
-// TODO(estade): On linux, the renderer process doesn't seem to quit and pegs
-// CPU.
// Tests closing the browser on a page with an unload listener registered where
// the unload handler has an infinite loop.
TEST_F(UnloadTest, BrowserCloseInfiniteUnload) {