| 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/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/test/test_switches.h" | 10 #include "base/test/test_switches.h" |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 #ifdef ADDRESS_SANITIZER | 14 // ASan and TSan instrument each memory access. This may slow the execution |
| 15 // down significantly. |
| 16 #if defined(ADDRESS_SANITIZER) || defined(THREAD_SANITIZER) |
| 15 static const int kTimeoutMultiplier = 2; | 17 static const int kTimeoutMultiplier = 2; |
| 16 #else | 18 #else |
| 17 static const int kTimeoutMultiplier = 1; | 19 static const int kTimeoutMultiplier = 1; |
| 18 #endif | 20 #endif |
| 19 | 21 |
| 20 // Sets value to the greatest of: | 22 // Sets value to the greatest of: |
| 21 // 1) value's current value multiplied by kTimeoutMultiplier (assuming | 23 // 1) value's current value multiplied by kTimeoutMultiplier (assuming |
| 22 // InitializeTimeout is called only once per value). | 24 // InitializeTimeout is called only once per value). |
| 23 // 2) min_value. | 25 // 2) min_value. |
| 24 // 3) the numerical value given by switch_name on the command line multiplied | 26 // 3) the numerical value given by switch_name on the command line multiplied |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 InitializeTimeout(switches::kUiTestActionMaxTimeout, action_timeout_ms_, | 79 InitializeTimeout(switches::kUiTestActionMaxTimeout, action_timeout_ms_, |
| 78 &action_max_timeout_ms_); | 80 &action_max_timeout_ms_); |
| 79 InitializeTimeout(switches::kTestLargeTimeout, action_max_timeout_ms_, | 81 InitializeTimeout(switches::kTestLargeTimeout, action_max_timeout_ms_, |
| 80 &large_test_timeout_ms_); | 82 &large_test_timeout_ms_); |
| 81 | 83 |
| 82 // The timeout values should be increasing in the right order. | 84 // The timeout values should be increasing in the right order. |
| 83 CHECK(tiny_timeout_ms_ <= action_timeout_ms_); | 85 CHECK(tiny_timeout_ms_ <= action_timeout_ms_); |
| 84 CHECK(action_timeout_ms_ <= action_max_timeout_ms_); | 86 CHECK(action_timeout_ms_ <= action_max_timeout_ms_); |
| 85 CHECK(action_max_timeout_ms_ <= large_test_timeout_ms_); | 87 CHECK(action_max_timeout_ms_ <= large_test_timeout_ms_); |
| 86 } | 88 } |
| OLD | NEW |