OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "base/test/test_timeouts.h" | 5 #include "base/test/test_timeouts.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/debugger.h" | 8 #include "base/debug/debugger.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // static | 59 // static |
60 int TestTimeouts::tiny_timeout_ms_ = 100; | 60 int TestTimeouts::tiny_timeout_ms_ = 100; |
61 int TestTimeouts::action_timeout_ms_ = 10000; | 61 int TestTimeouts::action_timeout_ms_ = 10000; |
62 #ifndef NDEBUG | 62 #ifndef NDEBUG |
63 int TestTimeouts::action_max_timeout_ms_ = 45000; | 63 int TestTimeouts::action_max_timeout_ms_ = 45000; |
64 #else | 64 #else |
65 int TestTimeouts::action_max_timeout_ms_ = 30000; | 65 int TestTimeouts::action_max_timeout_ms_ = 30000; |
66 #endif // NDEBUG | 66 #endif // NDEBUG |
67 int TestTimeouts::large_test_timeout_ms_ = 10 * 60 * 1000; | 67 int TestTimeouts::large_test_timeout_ms_ = 10 * 60 * 1000; |
68 | 68 |
| 69 int TestTimeouts::test_launcher_timeout_ms_ = 45000; |
| 70 |
69 // static | 71 // static |
70 void TestTimeouts::Initialize() { | 72 void TestTimeouts::Initialize() { |
71 if (initialized_) { | 73 if (initialized_) { |
72 NOTREACHED(); | 74 NOTREACHED(); |
73 return; | 75 return; |
74 } | 76 } |
75 initialized_ = true; | 77 initialized_ = true; |
76 | 78 |
77 if (base::debug::BeingDebugged()) { | 79 if (base::debug::BeingDebugged()) { |
78 fprintf(stdout, | 80 fprintf(stdout, |
79 "Detected presence of a debugger, running without test timeouts.\n"); | 81 "Detected presence of a debugger, running without test timeouts.\n"); |
80 } | 82 } |
81 | 83 |
82 // Note that these timeouts MUST be initialized in the correct order as | 84 // Note that these timeouts MUST be initialized in the correct order as |
83 // per the CHECKS below. | 85 // per the CHECKS below. |
84 InitializeTimeout(switches::kTestTinyTimeout, &tiny_timeout_ms_); | 86 InitializeTimeout(switches::kTestTinyTimeout, &tiny_timeout_ms_); |
85 InitializeTimeout(switches::kUiTestActionTimeout, | 87 InitializeTimeout(switches::kUiTestActionTimeout, |
86 base::debug::BeingDebugged() ? kAlmostInfiniteTimeoutMs | 88 base::debug::BeingDebugged() ? kAlmostInfiniteTimeoutMs |
87 : tiny_timeout_ms_, | 89 : tiny_timeout_ms_, |
88 &action_timeout_ms_); | 90 &action_timeout_ms_); |
89 InitializeTimeout(switches::kUiTestActionMaxTimeout, action_timeout_ms_, | 91 InitializeTimeout(switches::kUiTestActionMaxTimeout, action_timeout_ms_, |
90 &action_max_timeout_ms_); | 92 &action_max_timeout_ms_); |
91 InitializeTimeout(switches::kTestLargeTimeout, action_max_timeout_ms_, | 93 InitializeTimeout(switches::kTestLargeTimeout, action_max_timeout_ms_, |
92 &large_test_timeout_ms_); | 94 &large_test_timeout_ms_); |
93 | 95 |
| 96 // Test launcher timeout is independent from anything above action timeout. |
| 97 InitializeTimeout(switches::kTestLauncherTimeout, action_timeout_ms_, |
| 98 &test_launcher_timeout_ms_); |
| 99 |
94 // The timeout values should be increasing in the right order. | 100 // The timeout values should be increasing in the right order. |
95 CHECK(tiny_timeout_ms_ <= action_timeout_ms_); | 101 CHECK(tiny_timeout_ms_ <= action_timeout_ms_); |
96 CHECK(action_timeout_ms_ <= action_max_timeout_ms_); | 102 CHECK(action_timeout_ms_ <= action_max_timeout_ms_); |
97 CHECK(action_max_timeout_ms_ <= large_test_timeout_ms_); | 103 CHECK(action_max_timeout_ms_ <= large_test_timeout_ms_); |
| 104 |
| 105 CHECK(action_timeout_ms_ <= test_launcher_timeout_ms_); |
98 } | 106 } |
OLD | NEW |