Chromium Code Reviews| 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 23 matching lines...) Expand all Loading... | |
| 34 const int kAlmostInfiniteTimeoutMs = 100000000; | 34 const int kAlmostInfiniteTimeoutMs = 100000000; |
| 35 | 35 |
| 36 // Sets value to the greatest of: | 36 // Sets value to the greatest of: |
| 37 // 1) value's current value multiplied by kTimeoutMultiplier (assuming | 37 // 1) value's current value multiplied by kTimeoutMultiplier (assuming |
| 38 // InitializeTimeout is called only once per value). | 38 // InitializeTimeout is called only once per value). |
| 39 // 2) min_value. | 39 // 2) min_value. |
| 40 // 3) the numerical value given by switch_name on the command line multiplied | 40 // 3) the numerical value given by switch_name on the command line multiplied |
| 41 // by kTimeoutMultiplier. | 41 // by kTimeoutMultiplier. |
| 42 void InitializeTimeout(const char* switch_name, int min_value, int* value) { | 42 void InitializeTimeout(const char* switch_name, int min_value, int* value) { |
| 43 DCHECK(value); | 43 DCHECK(value); |
| 44 if (CommandLine::ForCurrentProcess()->HasSwitch(switch_name)) { | 44 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switch_name)) { |
| 45 std::string string_value( | 45 std::string string_value(base::CommandLine::ForCurrentProcess()-> |
| 46 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switch_name)); | 46 GetSwitchValueASCII(switch_name)); |
|
rvargas (doing something else)
2014/10/22 01:43:38
nit: indentation is off
| |
| 47 int timeout; | 47 int timeout; |
| 48 base::StringToInt(string_value, &timeout); | 48 base::StringToInt(string_value, &timeout); |
| 49 *value = std::max(*value, timeout); | 49 *value = std::max(*value, timeout); |
| 50 } | 50 } |
| 51 *value *= kTimeoutMultiplier; | 51 *value *= kTimeoutMultiplier; |
| 52 *value = std::max(*value, min_value); | 52 *value = std::max(*value, min_value); |
| 53 } | 53 } |
| 54 | 54 |
| 55 // Sets value to the greatest of: | 55 // Sets value to the greatest of: |
| 56 // 1) value's current value multiplied by kTimeoutMultiplier. | 56 // 1) value's current value multiplied by kTimeoutMultiplier. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 // Test launcher timeout is independent from anything above action timeout. | 104 // Test launcher timeout is independent from anything above action timeout. |
| 105 InitializeTimeout(switches::kTestLauncherTimeout, action_timeout_ms_, | 105 InitializeTimeout(switches::kTestLauncherTimeout, action_timeout_ms_, |
| 106 &test_launcher_timeout_ms_); | 106 &test_launcher_timeout_ms_); |
| 107 | 107 |
| 108 // The timeout values should be increasing in the right order. | 108 // The timeout values should be increasing in the right order. |
| 109 CHECK(tiny_timeout_ms_ <= action_timeout_ms_); | 109 CHECK(tiny_timeout_ms_ <= action_timeout_ms_); |
| 110 CHECK(action_timeout_ms_ <= action_max_timeout_ms_); | 110 CHECK(action_timeout_ms_ <= action_max_timeout_ms_); |
| 111 | 111 |
| 112 CHECK(action_timeout_ms_ <= test_launcher_timeout_ms_); | 112 CHECK(action_timeout_ms_ <= test_launcher_timeout_ms_); |
| 113 } | 113 } |
| OLD | NEW |