Updating XTBs based on .GRDs from branch master
[chromium-blink-merge.git] / ash / test / task_switch_time_tracker_test_api.h
blob42144855162ab479e9932106c1201732416b5846
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_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
11 #include "base/time/time.h"
13 namespace base {
14 class SimpleTestTickClock;
15 } // namespace base
17 namespace ash {
19 class TaskSwitchTimeTracker;
21 namespace test {
23 // Provides access TaskSwitchTimeTracker's internals.
24 class TaskSwitchTimeTrackerTestAPI {
25 public:
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;
40 private:
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);
50 } // namespace test
51 } // namespace ash
53 #endif // ASH_TEST_TASK_SWITCH_TIME_TRACKER_TEST_API_H_