Chromium Code Reviews| Index: chrome/test/ui/ui_test.cc |
| =================================================================== |
| --- chrome/test/ui/ui_test.cc (revision 52187) |
| +++ chrome/test/ui/ui_test.cc (working copy) |
| @@ -620,7 +620,10 @@ |
| 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 @@ |
| if (visible == wait_for_open) |
| return true; // Got the download shelf. |
| } |
| + |
| + ADD_FAILURE() << "Timeout reached in WaitForDownloadShelfVisibilityChange"; |
|
Paweł Hajdan Jr.
2010/07/14 00:16:58
You might want to add another log message in the o
|
| return false; |
| } |
| @@ -642,8 +647,13 @@ |
| 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 @@ |
| 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 @@ |
| return true; |
| } |
| + ADD_FAILURE() << "Timeout reached in WaitUntilCookieValue"; |
| return false; |
| } |
| @@ -797,6 +813,7 @@ |
| return cookie_value; |
| } |
| + ADD_FAILURE() << "Timeout reached in WaitUntilCookieNonEmpty"; |
| return std::string(); |
| } |
| @@ -824,16 +841,24 @@ |
| 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() { |