Use a TickClock instead of TimeTicks::Now() in Timer.

Code that uses a Timer cannot be unit tested without using sleep
or a mock timer because Timer uses TimeTicks::Now() to calculate the
run time for scheduled tasks. Using sleep makes tests slow and
unreliable, and using mock timers frequently requires unit tests to
have knowledge of internal implementation details of the code being
tested. By using a TickClock, tests can provide a mock implementation
of the TickClock that can be advanced without the use of sleep,
allowing tests to reliably verify the behavior of code as time
advances.

BUG=internal b/32644077

Review-Url: https://codereview.chromium.org/2484023002
Cr-Commit-Position: refs/heads/master@{#432113}
3 files changed