// Copyright 2018 The Chromium Authors. All rights reserved.// Use of this source code is governed by a BSD-style license that can be// found in the LICENSE file.import'context.dart';/// The current system clock instance.SystemClockgetsystemClock=>context[SystemClock];/// A class for making time based operations testable.classSystemClock{/// A const constructor to allow subclasses to be const.constSystemClock();/// Create a clock with a fixed current time.constfactorySystemClock.fixed(DateTimetime)=_FixedTimeClock;/// Retrieve the current time.DateTimenow()=>DateTime.now();/// Compute the time a given duration ago.DateTimeago(Durationduration){returnnow().subtract(duration);}}class_FixedTimeClockextendsSystemClock{const_FixedTimeClock(this._fixedTime);finalDateTime_fixedTime;@overrideDateTimenow()=>_fixedTime;}