From cbb9f50f408e81cc271df08fa969ef3f8d06bca1 Mon Sep 17 00:00:00 2001 From: "sergeyu@chromium.org" <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> Date: Tue, 5 Oct 2010 19:03:05 +0000 Subject: Move TestTimeouts from chrome/test to base/test. BUG=None TEST=unittests Review URL: http://codereview.chromium.org/3544008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61540 0039d316-1c4b-4281-b951-d872f2087c98 --- base/test/test_timeouts.h | 66 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 base/test/test_timeouts.h (limited to 'base/test/test_timeouts.h') diff --git a/base/test/test_timeouts.h b/base/test/test_timeouts.h new file mode 100644 index 0000000..d49ca2c --- /dev/null +++ b/base/test/test_timeouts.h @@ -0,0 +1,66 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef BASE_TEST_TEST_TIMEOUTS_H_ +#define BASE_TEST_TEST_TIMEOUTS_H_ + +#include "base/basictypes.h" + +// Returns common timeouts to use in tests. Makes it possible to adjust +// the timeouts for different environments (like Valgrind). +class TestTimeouts { + public: + // Initializes the timeouts. Non thread-safe. Should be called exactly once + // by the test suite. + static void Initialize(); + + // Timeout to wait for something to happen. If you are not sure + // which timeout to use, this is the one you want. + static int action_timeout_ms() { return action_timeout_ms_; } + + // Timeout longer than the above, but still suitable to use + // multiple times in a single test. Use if the timeout above + // is not sufficient. + static int action_max_timeout_ms() { return action_max_timeout_ms_; } + + // Timeout for a large test that may take a few minutes to run. + static int large_test_timeout_ms() { return large_test_timeout_ms_; } + + // Timeout for a huge test (like running a layout test inside the browser). + // Do not use unless absolutely necessary - try to make the test smaller. + // Do not use multiple times in a single test. + static int huge_test_timeout_ms() { return huge_test_timeout_ms_; } + + // Timeout to use for AutomationProxy. Do not use in other places. + // TODO(phajdan.jr): Remove command_execution_timeout_ms. + static int command_execution_timeout_ms() { + return command_execution_timeout_ms_; + } + + // Timeout to wait for a process to terminate. + static int wait_for_terminate_timeout_ms() { + return wait_for_terminate_timeout_ms_; + } + + // Timeout to wait for a live operation to complete. Used by tests that access + // external services. + static int live_operation_timeout_ms() { + return live_operation_timeout_ms_; + } + + private: + static bool initialized_; + + static int action_timeout_ms_; + static int action_max_timeout_ms_; + static int large_test_timeout_ms_; + static int huge_test_timeout_ms_; + static int command_execution_timeout_ms_; + static int wait_for_terminate_timeout_ms_; + static int live_operation_timeout_ms_; + + DISALLOW_IMPLICIT_CONSTRUCTORS(TestTimeouts); +}; + +#endif // BASE_TEST_TEST_TIMEOUTS_H_ -- cgit v1.1