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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/debugger.h" | 10 #include "base/debug/debugger.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // The timeout values should increase in the order they appear in this block. | 65 // The timeout values should increase in the order they appear in this block. |
66 // static | 66 // static |
67 int TestTimeouts::tiny_timeout_ms_ = 100; | 67 int TestTimeouts::tiny_timeout_ms_ = 100; |
68 int TestTimeouts::action_timeout_ms_ = 10000; | 68 int TestTimeouts::action_timeout_ms_ = 10000; |
69 #ifndef NDEBUG | 69 #ifndef NDEBUG |
70 int TestTimeouts::action_max_timeout_ms_ = 45000; | 70 int TestTimeouts::action_max_timeout_ms_ = 45000; |
71 #else | 71 #else |
72 int TestTimeouts::action_max_timeout_ms_ = 30000; | 72 int TestTimeouts::action_max_timeout_ms_ = 30000; |
73 #endif // NDEBUG | 73 #endif // NDEBUG |
74 | 74 |
| 75 // TODO(phajdan.jr): Fix slow tests and lower to 5s. |
| 76 int TestTimeouts::test_launcher_unit_timeout_ms_ = 15000; |
75 int TestTimeouts::test_launcher_timeout_ms_ = 45000; | 77 int TestTimeouts::test_launcher_timeout_ms_ = 45000; |
76 | 78 |
77 // static | 79 // static |
78 void TestTimeouts::Initialize() { | 80 void TestTimeouts::Initialize() { |
79 if (initialized_) { | 81 if (initialized_) { |
80 NOTREACHED(); | 82 NOTREACHED(); |
81 return; | 83 return; |
82 } | 84 } |
83 initialized_ = true; | 85 initialized_ = true; |
84 | 86 |
85 if (base::debug::BeingDebugged()) { | 87 if (base::debug::BeingDebugged()) { |
86 fprintf(stdout, | 88 fprintf(stdout, |
87 "Detected presence of a debugger, running without test timeouts.\n"); | 89 "Detected presence of a debugger, running without test timeouts.\n"); |
88 } | 90 } |
89 | 91 |
90 // Note that these timeouts MUST be initialized in the correct order as | 92 // Note that these timeouts MUST be initialized in the correct order as |
91 // per the CHECKS below. | 93 // per the CHECKS below. |
92 InitializeTimeout(switches::kTestTinyTimeout, &tiny_timeout_ms_); | 94 InitializeTimeout(switches::kTestTinyTimeout, &tiny_timeout_ms_); |
93 InitializeTimeout(switches::kUiTestActionTimeout, | 95 InitializeTimeout(switches::kUiTestActionTimeout, |
94 base::debug::BeingDebugged() ? kAlmostInfiniteTimeoutMs | 96 base::debug::BeingDebugged() ? kAlmostInfiniteTimeoutMs |
95 : tiny_timeout_ms_, | 97 : tiny_timeout_ms_, |
96 &action_timeout_ms_); | 98 &action_timeout_ms_); |
97 InitializeTimeout(switches::kUiTestActionMaxTimeout, action_timeout_ms_, | 99 InitializeTimeout(switches::kUiTestActionMaxTimeout, action_timeout_ms_, |
98 &action_max_timeout_ms_); | 100 &action_max_timeout_ms_); |
99 | 101 |
100 // Test launcher timeout is independent from anything above action timeout. | 102 // Test launcher timeout is independent from anything above action timeout. |
101 InitializeTimeout(switches::kTestLauncherTimeout, action_timeout_ms_, | 103 InitializeTimeout(switches::kTestLauncherUnitTimeout, action_timeout_ms_, |
| 104 &test_launcher_unit_timeout_ms_); |
| 105 InitializeTimeout(switches::kTestLauncherTimeout, |
| 106 test_launcher_unit_timeout_ms_, |
102 &test_launcher_timeout_ms_); | 107 &test_launcher_timeout_ms_); |
103 | 108 |
104 // The timeout values should be increasing in the right order. | 109 // The timeout values should be increasing in the right order. |
105 CHECK(tiny_timeout_ms_ <= action_timeout_ms_); | 110 CHECK(tiny_timeout_ms_ <= action_timeout_ms_); |
106 CHECK(action_timeout_ms_ <= action_max_timeout_ms_); | 111 CHECK(action_timeout_ms_ <= action_max_timeout_ms_); |
107 | 112 |
108 CHECK(action_timeout_ms_ <= test_launcher_timeout_ms_); | 113 CHECK(action_timeout_ms_ <= test_launcher_unit_timeout_ms_); |
| 114 CHECK(test_launcher_unit_timeout_ms_ <= test_launcher_timeout_ms_); |
109 } | 115 } |
OLD | NEW |