Chromium Code Reviews

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

Issue 195106: Implement per-test timeout for UI tests. (Closed)
Patch Set: sync with trunk Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « chrome/test/ui/ui_test.h ('k') | 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
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index cfabbc256349b5ee7291211106886186ebce255b..bed4292de8c913a897b672d9187bf78e4e83b162 100644
--- a/chrome/test/ui/ui_test.cc
+++ b/chrome/test/ui/ui_test.cc
@@ -44,6 +44,8 @@ static const int kWaitForActionMaxMsec = 10000;
static const int kMaxTestExecutionTime = 30000;
// Delay to let the browser shut down before trying more brutal methods.
static const int kWaitForTerminateMsec = 30000;
+// Timeout after which the test will be aborted.
+static const int kPerTestTimeoutMsec = 360000;
const wchar_t UITest::kFailedNoCrashService[] =
#if defined(OS_WIN)
@@ -73,11 +75,13 @@ std::wstring UITest::log_level_ = L"";
// Specify the time (in milliseconds) that the ui_tests should wait before
// timing out. This is used to specify longer timeouts when running under Purify
// which requires much more time.
+// TODO(phajdan.jr): ui-test-timeout is misleading name, rename it.
const wchar_t kUiTestTimeout[] = L"ui-test-timeout";
const wchar_t kUiTestActionTimeout[] = L"ui-test-action-timeout";
const wchar_t kUiTestActionMaxTimeout[] = L"ui-test-action-max-timeout";
const wchar_t kUiTestSleepTimeout[] = L"ui-test-sleep-timeout";
const wchar_t kUiTestTerminateTimeout[] = L"ui-test-terminate-timeout";
+const wchar_t kUiTestPerTestTimeout[] = L"ui-test-per-test-timeout";
const wchar_t kExtraChromeFlagsSwitch[] = L"extra-chrome-flags";
@@ -111,7 +115,8 @@ UITest::UITest()
action_timeout_ms_(kWaitForActionMsec),
action_max_timeout_ms_(kWaitForActionMaxMsec),
sleep_timeout_ms_(kWaitForActionMsec),
- terminate_timeout_ms_(kWaitForTerminateMsec) {
+ terminate_timeout_ms_(kWaitForTerminateMsec),
+ per_test_timeout_ms_(kPerTestTimeoutMsec) {
PathService::Get(chrome::DIR_APP, &browser_directory_);
PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_);
}
@@ -135,6 +140,8 @@ void UITest::SetUp() {
InitializeTimeouts();
LaunchBrowserAndServer();
+
+ automation()->QuitAfterTimeout(per_test_timeout_ms_);
}
void UITest::TearDown() {
@@ -207,6 +214,14 @@ void UITest::InitializeTimeouts() {
int terminate_timeout = StringToInt(WideToUTF16Hack(terminate_timeout_str));
terminate_timeout_ms_ = std::max(kWaitForActionMsec, terminate_timeout);
}
+
+ if (CommandLine::ForCurrentProcess()->HasSwitch(kUiTestPerTestTimeout)) {
+ std::wstring per_test_timeout_str =
+ CommandLine::ForCurrentProcess()->GetSwitchValue(
+ kUiTestPerTestTimeout);
+ int per_test_timeout = StringToInt(WideToUTF16Hack(per_test_timeout_str));
+ per_test_timeout_ms_ = std::max(kPerTestTimeoutMsec, per_test_timeout);
+ }
}
AutomationProxy* UITest::CreateAutomationProxy(int execution_timeout) {
« no previous file with comments | « chrome/test/ui/ui_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine