Commit 9af49803 authored by Adithya Srinivasan's avatar Adithya Srinivasan Committed by Commit Bot

Add note in base::ScopedMockClockOverride documentation

This just duplicates documentation from
base::subtle::ScopedTimeClockOverrides but I thought it was worth adding
it here, as ScopedMockClockOverride doesn't currently fix any of the
limitations.

Also, because of this limitation we can't use ScopedMockClockOverride as-is
in Blink tests. We create a task scheduler and a thread pool before running
tests on the main thread (and also call TimeTicks::Now from one of the
threads created).

Bug: 866930
Change-Id: If7b081bd980b8ac8780c892c21b082923edd1a29
Reviewed-on: https://chromium-review.googlesource.com/c/1324103Reviewed-by: default avatarkylechar <kylechar@chromium.org>
Commit-Queue: Adithya Srinivasan <adithyas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606502}
parent 86bb8bb9
......@@ -26,6 +26,10 @@ namespace base {
// For new unit tests, developers are highly encouraged to structure new code
// around a dependency injected base::Clock, base::TickClock, etc. to be able
// to supply a mock time in tests without a global override.
//
// NOTE: ScopedMockClockOverride should be created while single-threaded and
// before the first call to Now() to avoid threading issues and inconsistencies
// in returned values. Nested overrides are not allowed.
class ScopedMockClockOverride {
public:
ScopedMockClockOverride();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment