OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef ASH_TEST_TASK_SWITCH_TIME_TRACKER_TEST_API_H_ |
| 6 #define ASH_TEST_TASK_SWITCH_TIME_TRACKER_TEST_API_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/time/time.h" |
| 12 |
| 13 namespace base { |
| 14 class SimpleTestTickClock; |
| 15 } // namespace base |
| 16 |
| 17 namespace ash { |
| 18 |
| 19 class TaskSwitchTimeTracker; |
| 20 |
| 21 namespace test { |
| 22 |
| 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); |
| 29 |
| 30 ~TaskSwitchTimeTrackerTestAPI(); |
| 31 |
| 32 TaskSwitchTimeTracker* time_tracker() { return time_tracker_.get(); } |
| 33 |
| 34 // Advances |time_tracker_|'s TickClock by |time_delta|. |
| 35 void Advance(base::TimeDelta time_delta); |
| 36 |
| 37 // Wrapper function to access TaskSwitchTimeTracker::HasLastActionTime(); |
| 38 bool HasLastActionTime() const; |
| 39 |
| 40 private: |
| 41 // Owned by |time_tracker_|. |
| 42 base::SimpleTestTickClock* tick_clock_; |
| 43 |
| 44 // The TaskSwitchTimeTracker to provide internal access to. |
| 45 scoped_ptr<TaskSwitchTimeTracker> time_tracker_; |
| 46 |
| 47 DISALLOW_COPY_AND_ASSIGN(TaskSwitchTimeTrackerTestAPI); |
| 48 }; |
| 49 |
| 50 } // namespace test |
| 51 } // namespace ash |
| 52 |
| 53 #endif // ASH_TEST_TASK_SWITCH_TIME_TRACKER_TEST_API_H_ |
OLD | NEW |