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

Unified Diff: chrome/test/ui/ui_test.cc

Issue 2903012: Output some error text if one of these Wait functions should timeout.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698