// 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 CHROME_TEST_TEST_TIMEOUTS_H_ #define CHROME_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 (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 large_test_timeout_ms() { return large_test_timeout_ms_; } // Timeout used when calling Sleep. Deprecated (recommended // replacement is action_timeout_ms). // TODO(phajdan.jr): Remove sleep_timeout_ms. static int sleep_timeout_ms() { return sleep_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_; } private: static bool initialized_; static int action_timeout_ms_; static int action_max_timeout_ms_; static int large_test_timeout_ms_; static int sleep_timeout_ms_; static int command_execution_timeout_ms_; static int wait_for_terminate_timeout_ms_; DISALLOW_IMPLICIT_CONSTRUCTORS(TestTimeouts); }; #endif // CHROME_TEST_TEST_TIMEOUTS_H_