diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-05 19:03:05 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-05 19:03:05 +0000 |
commit | cbb9f50f408e81cc271df08fa969ef3f8d06bca1 (patch) | |
tree | c011aa7829510d1cfc39c8ad49ee66e412bfdfa7 /base/test/test_timeouts.h | |
parent | 6b1b77e9f51dcf24fff29720d6b4063983a2d5b8 (diff) | |
download | chromium_src-cbb9f50f408e81cc271df08fa969ef3f8d06bca1.zip chromium_src-cbb9f50f408e81cc271df08fa969ef3f8d06bca1.tar.gz chromium_src-cbb9f50f408e81cc271df08fa969ef3f8d06bca1.tar.bz2 |
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
Diffstat (limited to 'base/test/test_timeouts.h')
-rw-r--r-- | base/test/test_timeouts.h | 66 |
1 files changed, 66 insertions, 0 deletions
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_ |