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

Unified Diff: chrome/test/ui/ui_test.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/test/ui/ui_test.cc
===================================================================
--- chrome/test/ui/ui_test.cc (revision 80488)
+++ chrome/test/ui/ui_test.cc (working copy)
@@ -297,10 +297,6 @@
url, number_of_navigations)) << url.spec();
}
-bool UITestBase::WaitForBrowserProcessToQuit(int timeout) {
- return launcher_->WaitForBrowserProcessToQuit(timeout);
-}
-
bool UITestBase::WaitForBookmarkBarVisibilityChange(BrowserProxy* browser,
bool wait_for_open) {
const int kCycles = 10;
@@ -313,11 +309,7 @@
return true; // Bookmark bar visibility change complete.
// Give it a chance to catch up.
- bool browser_survived = CrashAwareSleep(
- TestTimeouts::action_timeout_ms() / kCycles);
- EXPECT_TRUE(browser_survived);
- if (!browser_survived)
- return false;
+ base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms() / kCycles);
}
ADD_FAILURE() << "Timeout reached in WaitForBookmarkBarVisibilityChange";
@@ -365,10 +357,6 @@
return launcher_->IsBrowserRunning();
}
-bool UITestBase::CrashAwareSleep(int timeout_ms) {
- return launcher_->CrashAwareSleep(timeout_ms);
-}
-
int UITestBase::GetTabCount() {
return GetTabCount(0);
}
@@ -391,12 +379,10 @@
const int kIntervalMs = TestTimeouts::action_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)
return;
+
+ base::PlatformThread::Sleep(kIntervalMs);
}
ADD_FAILURE() << "Timeout reached in WaitUntilTabCount";
@@ -727,11 +713,6 @@
// Wait until the test signals it has completed.
for (int i = 0; i < kMaxIntervals; ++i) {
- bool browser_survived = CrashAwareSleep(kIntervalMs);
- EXPECT_TRUE(browser_survived);
- if (!browser_survived)
- return false;
-
bool done_value = false;
bool success = tab->ExecuteAndExtractBool(frame_xpath, jscript,
&done_value);
@@ -740,6 +721,8 @@
return false;
if (done_value)
return true;
+
+ base::PlatformThread::Sleep(kIntervalMs);
}
ADD_FAILURE() << "Timeout reached in WaitUntilJavaScriptCondition";
@@ -756,14 +739,11 @@
std::string cookie_value;
for (int i = 0; i < kMaxIntervals; ++i) {
- bool browser_survived = CrashAwareSleep(kIntervalMs);
- EXPECT_TRUE(browser_survived);
- if (!browser_survived)
- return false;
-
EXPECT_TRUE(tab->GetCookieByName(url, cookie_name, &cookie_value));
if (cookie_value == expected_value)
return true;
+
+ base::PlatformThread::Sleep(kIntervalMs);
}
ADD_FAILURE() << "Timeout reached in WaitUntilCookieValue";
@@ -778,15 +758,12 @@
const int kMaxIntervals = timeout_ms / kIntervalMs;
for (int i = 0; i < kMaxIntervals; ++i) {
- bool browser_survived = CrashAwareSleep(kIntervalMs);
- EXPECT_TRUE(browser_survived);
- if (!browser_survived)
- return std::string();
-
std::string cookie_value;
EXPECT_TRUE(tab->GetCookieByName(url, cookie_name, &cookie_value));
if (!cookie_value.empty())
return cookie_value;
+
+ base::PlatformThread::Sleep(kIntervalMs);
}
ADD_FAILURE() << "Timeout reached in WaitUntilCookieNonEmpty";
@@ -812,11 +789,7 @@
return true; // Find window visibility change complete.
// Give it a chance to catch up.
- bool browser_survived = CrashAwareSleep(
- TestTimeouts::action_timeout_ms() / kCycles);
- EXPECT_TRUE(browser_survived);
- if (!browser_survived)
- return false;
+ base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms() / kCycles);
}
ADD_FAILURE() << "Timeout reached in WaitForFindWindowVisibilityChange";
@@ -840,19 +813,6 @@
int incorrect_state_count = 0;
base::Time start = base::Time::Now();
for (int i = 0; i < kCycles; i++) {
- // Give it a chance to catch up.
- bool browser_survived = CrashAwareSleep(
- TestTimeouts::action_timeout_ms() / kCycles);
- EXPECT_TRUE(browser_survived);
- if (!browser_survived) {
- LOG(INFO) << "Elapsed time: " << (base::Time::Now() - start).InSecondsF()
- << " seconds"
- << " call failed " << fail_count << " times"
- << " state was incorrect " << incorrect_state_count << " times";
- ADD_FAILURE() << "Browser failed in " << __FUNCTION__;
- return false;
- }
-
bool visible = !wait_for_open;
if (!browser->IsShelfVisible(&visible)) {
fail_count++;
@@ -866,6 +826,9 @@
return true; // Got the download shelf.
}
incorrect_state_count++;
+
+ // Give it a chance to catch up.
+ base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms() / kCycles);
}
LOG(INFO) << "Elapsed time: " << (base::Time::Now() - start).InSecondsF()

Powered by Google App Engine
This is Rietveld 408576698