blob: 8405a519985c12f2f70861c5e5464e0e7f7f87b3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
// 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_
|