OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/test/test_switches.h" | 10 #include "base/test/test_switches.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 InitializeTimeout(switch_name, 0, value); | 35 InitializeTimeout(switch_name, 0, value); |
36 } | 36 } |
37 | 37 |
38 } // namespace | 38 } // namespace |
39 | 39 |
40 // static | 40 // static |
41 bool TestTimeouts::initialized_ = false; | 41 bool TestTimeouts::initialized_ = false; |
42 | 42 |
43 // The timeout values should increase in the order they appear in this block. | 43 // The timeout values should increase in the order they appear in this block. |
44 // static | 44 // static |
| 45 int TestTimeouts::tiny_timeout_ms_ = 100; |
45 int TestTimeouts::action_timeout_ms_ = 2000; | 46 int TestTimeouts::action_timeout_ms_ = 2000; |
46 int TestTimeouts::action_max_timeout_ms_ = 15000; | 47 int TestTimeouts::action_max_timeout_ms_ = 15000; |
47 int TestTimeouts::large_test_timeout_ms_ = 3 * 60 * 1000; | 48 int TestTimeouts::large_test_timeout_ms_ = 3 * 60 * 1000; |
48 int TestTimeouts::huge_test_timeout_ms_ = 10 * 60 * 1000; | 49 int TestTimeouts::huge_test_timeout_ms_ = 10 * 60 * 1000; |
49 | 50 |
50 // static | 51 // static |
51 int TestTimeouts::command_execution_timeout_ms_ = 25000; | 52 int TestTimeouts::command_execution_timeout_ms_ = 25000; |
52 | 53 |
53 // static | 54 // static |
54 int TestTimeouts::wait_for_terminate_timeout_ms_ = 15000; | 55 int TestTimeouts::wait_for_terminate_timeout_ms_ = 15000; |
55 | 56 |
56 // static | 57 // static |
57 int TestTimeouts::live_operation_timeout_ms_ = 30000; | 58 int TestTimeouts::live_operation_timeout_ms_ = 30000; |
58 | 59 |
59 // static | 60 // static |
60 void TestTimeouts::Initialize() { | 61 void TestTimeouts::Initialize() { |
61 if (initialized_) { | 62 if (initialized_) { |
62 NOTREACHED(); | 63 NOTREACHED(); |
63 return; | 64 return; |
64 } | 65 } |
65 initialized_ = true; | 66 initialized_ = true; |
66 | 67 |
67 // Note that these timeouts MUST be initialized in the correct order as | 68 // Note that these timeouts MUST be initialized in the correct order as |
68 // per the CHECKS below. | 69 // per the CHECKS below. |
69 InitializeTimeout(switches::kUiTestActionTimeout, &action_timeout_ms_); | 70 InitializeTimeout(switches::kTestTinyTimeout, &tiny_timeout_ms_); |
| 71 InitializeTimeout(switches::kUiTestActionTimeout, tiny_timeout_ms_, |
| 72 &action_timeout_ms_); |
70 InitializeTimeout(switches::kUiTestActionMaxTimeout, action_timeout_ms_, | 73 InitializeTimeout(switches::kUiTestActionMaxTimeout, action_timeout_ms_, |
71 &action_max_timeout_ms_); | 74 &action_max_timeout_ms_); |
72 InitializeTimeout(switches::kTestLargeTimeout, action_max_timeout_ms_, | 75 InitializeTimeout(switches::kTestLargeTimeout, action_max_timeout_ms_, |
73 &large_test_timeout_ms_); | 76 &large_test_timeout_ms_); |
74 InitializeTimeout(switches::kUiTestTimeout, large_test_timeout_ms_, | 77 InitializeTimeout(switches::kUiTestTimeout, large_test_timeout_ms_, |
75 &huge_test_timeout_ms_); | 78 &huge_test_timeout_ms_); |
76 | 79 |
77 // The timeout values should be increasing in the right order. | 80 // The timeout values should be increasing in the right order. |
| 81 CHECK(tiny_timeout_ms_ <= action_timeout_ms_); |
78 CHECK(action_timeout_ms_ <= action_max_timeout_ms_); | 82 CHECK(action_timeout_ms_ <= action_max_timeout_ms_); |
79 CHECK(action_max_timeout_ms_ <= large_test_timeout_ms_); | 83 CHECK(action_max_timeout_ms_ <= large_test_timeout_ms_); |
80 CHECK(large_test_timeout_ms_ <= huge_test_timeout_ms_); | 84 CHECK(large_test_timeout_ms_ <= huge_test_timeout_ms_); |
81 | 85 |
82 InitializeTimeout(switches::kUiTestCommandExecutionTimeout, | 86 InitializeTimeout(switches::kUiTestCommandExecutionTimeout, |
83 &command_execution_timeout_ms_); | 87 &command_execution_timeout_ms_); |
84 InitializeTimeout(switches::kUiTestTerminateTimeout, | 88 InitializeTimeout(switches::kUiTestTerminateTimeout, |
85 &wait_for_terminate_timeout_ms_); | 89 &wait_for_terminate_timeout_ms_); |
86 | 90 |
87 InitializeTimeout(switches::kLiveOperationTimeout, | 91 InitializeTimeout(switches::kLiveOperationTimeout, |
88 &live_operation_timeout_ms_); | 92 &live_operation_timeout_ms_); |
89 } | 93 } |
OLD | NEW |