diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-14 06:40:55 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-14 06:40:55 +0000 |
commit | 84d62a3b9c86376079352ab97bd9c35e067b6a70 (patch) | |
tree | 54c1169032d37e61fd27a342a2257f5a27918bb2 /chrome/test | |
parent | 7374f881cd8f85aef012ab6be574a49db1f401c7 (diff) | |
download | chromium_src-84d62a3b9c86376079352ab97bd9c35e067b6a70.zip chromium_src-84d62a3b9c86376079352ab97bd9c35e067b6a70.tar.gz chromium_src-84d62a3b9c86376079352ab97bd9c35e067b6a70.tar.bz2 |
Output some error text if one of these Wait functions should timeout.
R=phajdan.jr
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/2903012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52286 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r-- | chrome/test/ui/ui_test.cc | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index 023e16f..05f6853 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -620,7 +620,10 @@ bool UITestBase::WaitForDownloadShelfVisibilityChange(BrowserProxy* browser, const int kCycles = 10; for (int i = 0; i < kCycles; i++) { // Give it a chance to catch up. - PlatformThread::Sleep(sleep_timeout_ms() / kCycles); + bool browser_survived = CrashAwareSleep(sleep_timeout_ms() / kCycles); + EXPECT_TRUE(browser_survived); + if (!browser_survived) + return false; bool visible = !wait_for_open; if (!browser->IsShelfVisible(&visible)) @@ -628,6 +631,8 @@ bool UITestBase::WaitForDownloadShelfVisibilityChange(BrowserProxy* browser, if (visible == wait_for_open) return true; // Got the download shelf. } + + ADD_FAILURE() << "Timeout reached in WaitForDownloadShelfVisibilityChange"; return false; } @@ -642,8 +647,13 @@ bool UITestBase::WaitForFindWindowVisibilityChange(BrowserProxy* browser, return true; // Find window visibility change complete. // Give it a chance to catch up. - PlatformThread::Sleep(sleep_timeout_ms() / kCycles); + bool browser_survived = CrashAwareSleep(sleep_timeout_ms() / kCycles); + EXPECT_TRUE(browser_survived); + if (!browser_survived) + return false; } + + ADD_FAILURE() << "Timeout reached in WaitForFindWindowVisibilityChange"; return false; } @@ -659,8 +669,13 @@ bool UITestBase::WaitForBookmarkBarVisibilityChange(BrowserProxy* browser, return true; // Bookmark bar visibility change complete. // Give it a chance to catch up. - PlatformThread::Sleep(sleep_timeout_ms() / kCycles); + bool browser_survived = CrashAwareSleep(sleep_timeout_ms() / kCycles); + EXPECT_TRUE(browser_survived); + if (!browser_survived) + return false; } + + ADD_FAILURE() << "Timeout reached in WaitForBookmarkBarVisibilityChange"; return false; } @@ -775,6 +790,7 @@ bool UITestBase::WaitUntilCookieValue(TabProxy* tab, return true; } + ADD_FAILURE() << "Timeout reached in WaitUntilCookieValue"; return false; } @@ -797,6 +813,7 @@ std::string UITestBase::WaitUntilCookieNonEmpty(TabProxy* tab, return cookie_value; } + ADD_FAILURE() << "Timeout reached in WaitUntilCookieNonEmpty"; return std::string(); } @@ -824,16 +841,24 @@ bool UITestBase::WaitUntilJavaScriptCondition(TabProxy* tab, return true; } + ADD_FAILURE() << "Timeout reached in WaitUntilJavaScriptCondition"; return false; } void UITestBase::WaitUntilTabCount(int tab_count) { - for (int i = 0; i < 10; ++i) { - PlatformThread::Sleep(sleep_timeout_ms() / 10); + const int kMaxIntervals = 10; + const int kIntervalMs = sleep_timeout_ms() / kMaxIntervals; + + for (int i = 0; i < kMaxIntervals; ++i) { + bool browser_survived = CrashAwareSleep(kIntervalMs); + EXPECT_TRUE(browser_survived); + if (!browser_survived) + return; if (GetTabCount() == tab_count) - break; + return; } - EXPECT_EQ(tab_count, GetTabCount()); + + ADD_FAILURE() << "Timeout reached in WaitUntilTabCount"; } FilePath UITestBase::GetDownloadDirectory() { |