OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/test/task_switch_time_tracker_test_api.h" | 5 #include "ash/test/task_switch_time_tracker_test_api.h" |
6 | 6 |
7 #include "ash/metrics/task_switch_time_tracker.h" | 7 #include "ash/metrics/task_switch_time_tracker.h" |
8 #include "base/test/simple_test_tick_clock.h" | 8 #include "base/test/simple_test_tick_clock.h" |
9 | 9 |
10 namespace ash { | 10 namespace ash { |
11 namespace test { | 11 namespace test { |
12 | 12 |
13 TaskSwitchTimeTrackerTestAPI::TaskSwitchTimeTrackerTestAPI( | 13 TaskSwitchTimeTrackerTestAPI::TaskSwitchTimeTrackerTestAPI( |
14 const std::string& histogram_name) { | 14 const std::string& histogram_name) { |
15 tick_clock_ = new base::SimpleTestTickClock(); | 15 tick_clock_ = new base::SimpleTestTickClock(base::TimeTicks()); |
16 time_tracker_.reset(new TaskSwitchTimeTracker( | 16 time_tracker_.reset(new TaskSwitchTimeTracker( |
17 histogram_name, scoped_ptr<base::TickClock>(tick_clock_))); | 17 histogram_name, scoped_ptr<base::TickClock>(tick_clock_))); |
18 } | 18 } |
19 | 19 |
20 TaskSwitchTimeTrackerTestAPI::~TaskSwitchTimeTrackerTestAPI() { | 20 TaskSwitchTimeTrackerTestAPI::~TaskSwitchTimeTrackerTestAPI() { |
21 tick_clock_ = nullptr; | 21 tick_clock_ = nullptr; |
22 } | 22 } |
23 | 23 |
24 void TaskSwitchTimeTrackerTestAPI::Advance(base::TimeDelta time_delta) { | 24 void TaskSwitchTimeTrackerTestAPI::Advance(base::TimeDelta time_delta) { |
25 tick_clock_->Advance(time_delta); | 25 tick_clock_->Advance(time_delta); |
26 } | 26 } |
27 | 27 |
28 bool TaskSwitchTimeTrackerTestAPI::HasLastActionTime() const { | 28 bool TaskSwitchTimeTrackerTestAPI::HasLastActionTime() const { |
29 return time_tracker_->HasLastActionTime(); | 29 return time_tracker_->HasLastActionTime(); |
30 } | 30 } |
31 | 31 |
32 } // namespace test | 32 } // namespace test |
33 } // namespace ash | 33 } // namespace ash |
OLD | NEW |