1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ash/test/task_switch_time_tracker_test_api.h"
7 #include "ash/metrics/task_switch_time_tracker.h"
8 #include "base/test/simple_test_tick_clock.h"
13 TaskSwitchTimeTrackerTestAPI::TaskSwitchTimeTrackerTestAPI(
14 const std::string
& histogram_name
) {
15 tick_clock_
= new base::SimpleTestTickClock();
16 time_tracker_
.reset(new TaskSwitchTimeTracker(
17 histogram_name
, scoped_ptr
<base::TickClock
>(tick_clock_
)));
20 TaskSwitchTimeTrackerTestAPI::~TaskSwitchTimeTrackerTestAPI() {
21 tick_clock_
= nullptr;
24 void TaskSwitchTimeTrackerTestAPI::Advance(base::TimeDelta time_delta
) {
25 tick_clock_
->Advance(time_delta
);
28 bool TaskSwitchTimeTrackerTestAPI::HasLastActionTime() const {
29 return time_tracker_
->HasLastActionTime();