OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_TEST_TEST_TIMEOUTS_H_ | 5 #ifndef BASE_TEST_TEST_TIMEOUTS_H_ |
6 #define BASE_TEST_TEST_TIMEOUTS_H_ | 6 #define BASE_TEST_TEST_TIMEOUTS_H_ |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 | 11 |
12 // Returns common timeouts to use in tests. Makes it possible to adjust | 12 // Returns common timeouts to use in tests. Makes it possible to adjust |
13 // the timeouts for different environments (like Valgrind). | 13 // the timeouts for different environments (like Valgrind). |
14 class TestTimeouts { | 14 class TestTimeouts { |
15 public: | 15 public: |
16 // Argument that can be passed on the command line to indicate "no timeout". | |
17 static const char kNoTimeoutSwitchValue[]; | |
Peter Kasting
2016/12/15 08:12:29
Nit: Can this be declared constexpr? Maybe by mov
tapted
2016/12/16 04:21:53
Done. Although (curiously?) Clang was happy with j
Peter Kasting
2016/12/16 06:30:56
That's all very weird... when I tested something s
| |
18 | |
16 // Initializes the timeouts. Non thread-safe. Should be called exactly once | 19 // Initializes the timeouts. Non thread-safe. Should be called exactly once |
17 // by the test suite. | 20 // by the test suite. |
18 static void Initialize(); | 21 static void Initialize(); |
19 | 22 |
20 // Timeout for actions that are expected to finish "almost instantly". | 23 // Timeout for actions that are expected to finish "almost instantly". |
21 static base::TimeDelta tiny_timeout() { | 24 static base::TimeDelta tiny_timeout() { |
22 DCHECK(initialized_); | 25 DCHECK(initialized_); |
23 return base::TimeDelta::FromMilliseconds(tiny_timeout_ms_); | 26 return base::TimeDelta::FromMilliseconds(tiny_timeout_ms_); |
24 } | 27 } |
25 | 28 |
(...skipping 24 matching lines...) Expand all Loading... | |
50 | 53 |
51 static int tiny_timeout_ms_; | 54 static int tiny_timeout_ms_; |
52 static int action_timeout_ms_; | 55 static int action_timeout_ms_; |
53 static int action_max_timeout_ms_; | 56 static int action_max_timeout_ms_; |
54 static int test_launcher_timeout_ms_; | 57 static int test_launcher_timeout_ms_; |
55 | 58 |
56 DISALLOW_IMPLICIT_CONSTRUCTORS(TestTimeouts); | 59 DISALLOW_IMPLICIT_CONSTRUCTORS(TestTimeouts); |
57 }; | 60 }; |
58 | 61 |
59 #endif // BASE_TEST_TEST_TIMEOUTS_H_ | 62 #endif // BASE_TEST_TEST_TIMEOUTS_H_ |
OLD | NEW |