Chrome Version : 57.0.2946.0
Started from a desire to be more explicit about "disabling" test timeouts. E.g. when base::debug::BeingDebugged() is true, timeouts should be disabled.
Currently the approach is via
const int kAlmostInfiniteTimeoutMs = 100000000;
which may later be multiplied (so it can't be MAX_INT).
Rather than copying a 10^n constant in https://codereview.chromium.org/2532793002/ to feed the idea of a disabled timeout on the command line - we went with something explicit (kNoTimeoutSwitchValue), but it would also be nice to go from "almost infinite" to TimeDelta::Max() to be extra explicit.
I think the nicest approach to doing this starts with making class TestTimeouts's static data members base::TimeDelta instead of just `int`. Of course we need to avoid static initializers. This can now be done with constexpr
r394527 made many of the TimeDelta methods constexpr, but more can be done (e.g. default constructor and TimeDelta::Max()).
Then InitializeTimeout in test_timeouts.cc needs to beware not to overflow (TimeDelta's operator*() already checks for overflow and caps to TimeDelta::Max(), so this should be straightforward).
Comment 1 by pkasting@chromium.org
, Dec 16 2016