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 #ifndef ASH_TEST_TASK_SWITCH_TIME_TRACKER_TEST_API_H_
6 #define ASH_TEST_TASK_SWITCH_TIME_TRACKER_TEST_API_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "base/time/time.h"
14 class SimpleTestTickClock
;
19 class TaskSwitchTimeTracker
;
23 // Provides access TaskSwitchTimeTracker's internals.
24 class TaskSwitchTimeTrackerTestAPI
{
26 // Creates a TaskSwitchTimeTracker with the given |histogram_name| and injects
27 // a base::SimpleTestTickClock that can be controlled.
28 explicit TaskSwitchTimeTrackerTestAPI(const std::string
& histogram_name
);
30 ~TaskSwitchTimeTrackerTestAPI();
32 TaskSwitchTimeTracker
* time_tracker() { return time_tracker_
.get(); }
34 // Advances |time_tracker_|'s TickClock by |time_delta|.
35 void Advance(base::TimeDelta time_delta
);
37 // Wrapper function to access TaskSwitchTimeTracker::HasLastActionTime();
38 bool HasLastActionTime() const;
41 // Owned by |time_tracker_|.
42 base::SimpleTestTickClock
* tick_clock_
;
44 // The TaskSwitchTimeTracker to provide internal access to.
45 scoped_ptr
<TaskSwitchTimeTracker
> time_tracker_
;
47 DISALLOW_COPY_AND_ASSIGN(TaskSwitchTimeTrackerTestAPI
);
53 #endif // ASH_TEST_TASK_SWITCH_TIME_TRACKER_TEST_API_H_