New issue
Advanced search Search tips

Issue 806265 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Feb 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Expose a TickClock on ScopedTaskEnvironment

Project Member Reported by fdoray@chromium.org, Jan 26 2018

Issue description

Currently, if a test needs to post delayed tasks and access a coherent time source from these delayed tasks, it has to create a MOCK_TIME ScopedTaskEnvironment and a SimpleTestTickClock, and advance both at the same time (e.g. https://chromium-review.googlesource.com/c/chromium/src/+/879225/3/services/resource_coordinator/observers/page_signal_generator_impl_unittest.cc#217). 

It would be better if ScopedTaskEnvironment exposed a TickClock. Calling ScopedTaskEnvironment::FastForwardBy/FastForwardUntilNoTasksRemain() would both run delayed tasks and advance the time of the exposed TickClock.

To implement this, would would simply need to add a method on ScopedTaskEnvironment that would return the TestMockTimeTaskRunner's TickClock.
 

Comment 1 by gab@chromium.org, Jan 28 2018

SGTM :)
Project Member

Comment 2 by bugdroid1@chromium.org, Feb 2 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e34860631da29d5d7d1910e6dfa1d96c7f5a1d11

commit e34860631da29d5d7d1910e6dfa1d96c7f5a1d11
Author: Sebastien Marchand <sebmarchand@chromium.org>
Date: Fri Feb 02 16:48:59 2018

Expose a TickClock on ScopedTaskEnvironment

Bug:  806265 
Change-Id: I4820b88096de01aa134715ebbe6cb1556d91b4ec
Reviewed-on: https://chromium-review.googlesource.com/888094
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: François Doray <fdoray@chromium.org>
Commit-Queue: Sébastien Marchand <sebmarchand@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534072}
[modify] https://crrev.com/e34860631da29d5d7d1910e6dfa1d96c7f5a1d11/base/test/scoped_task_environment.cc
[modify] https://crrev.com/e34860631da29d5d7d1910e6dfa1d96c7f5a1d11/base/test/scoped_task_environment.h
[modify] https://crrev.com/e34860631da29d5d7d1910e6dfa1d96c7f5a1d11/base/test/scoped_task_environment_unittest.cc

Status: Fixed (was: Assigned)

Sign in to add a comment