New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 674764 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 3
Type: Bug



Sign in to add a comment

base/test's TestTimeouts cleanup, and more constexpr for TimeDelta

Project Member Reported by tapted@chromium.org, Dec 15 2016

Issue description

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).
 
*handwave without looking at code* It would perhaps be nice to replace "timeout" with base::Optional<TimeDelta> or similar, to express the idea of "there might not be a timeout at all", and have any code that sets timers, etc. simply not set them, rather than setting them for TimeDelta::Max(), or similar.

TLDR: Plumb the concept that the timeout is optional through the code base at a fundamental level.
Project Member

Comment 2 by sheriffbot@chromium.org, Feb 16 2018

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available. If you change it back, also remove the "Hotlist-Recharge-Cold" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: -Hotlist-Recharge-Cold
Status: Available (was: Untriaged)

Sign in to add a comment