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/metrics/task_switch_time_tracker.h" | 5 #include "ash/metrics/task_switch_time_tracker.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "ash/test/task_switch_time_tracker_test_api.h" | 9 #include "ash/test/task_switch_time_tracker_test_api.h" |
10 #include "base/test/histogram_tester.h" | 10 #include "base/test/histogram_tester.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 // Wrapper to the test targets OnTaskSwitch() method. | 31 // Wrapper to the test targets OnTaskSwitch() method. |
32 void OnTaskSwitch(); | 32 void OnTaskSwitch(); |
33 | 33 |
34 TaskSwitchTimeTracker* time_tracker() { | 34 TaskSwitchTimeTracker* time_tracker() { |
35 return time_tracker_test_api_->time_tracker(); | 35 return time_tracker_test_api_->time_tracker(); |
36 } | 36 } |
37 | 37 |
38 protected: | 38 protected: |
39 // Used to verify recorded histogram data. | 39 // Used to verify recorded histogram data. |
40 scoped_ptr<base::HistogramTester> histogram_tester_; | 40 std::unique_ptr<base::HistogramTester> histogram_tester_; |
41 | 41 |
42 // A Test API that wraps the test target. | 42 // A Test API that wraps the test target. |
43 scoped_ptr<test::TaskSwitchTimeTrackerTestAPI> time_tracker_test_api_; | 43 std::unique_ptr<test::TaskSwitchTimeTrackerTestAPI> time_tracker_test_api_; |
44 | 44 |
45 private: | 45 private: |
46 DISALLOW_COPY_AND_ASSIGN(TaskSwitchTimeTrackerTest); | 46 DISALLOW_COPY_AND_ASSIGN(TaskSwitchTimeTrackerTest); |
47 }; | 47 }; |
48 | 48 |
49 TaskSwitchTimeTrackerTest::TaskSwitchTimeTrackerTest() { | 49 TaskSwitchTimeTrackerTest::TaskSwitchTimeTrackerTest() { |
50 } | 50 } |
51 | 51 |
52 TaskSwitchTimeTrackerTest::~TaskSwitchTimeTrackerTest() { | 52 TaskSwitchTimeTrackerTest::~TaskSwitchTimeTrackerTest() { |
53 } | 53 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 histogram_tester_->ExpectTotalCount(kHistogramName, 1); | 98 histogram_tester_->ExpectTotalCount(kHistogramName, 1); |
99 histogram_tester_->ExpectBucketCount(kHistogramName, 0, 1); | 99 histogram_tester_->ExpectBucketCount(kHistogramName, 0, 1); |
100 | 100 |
101 time_tracker_test_api_->Advance(base::TimeDelta::FromSeconds(1)); | 101 time_tracker_test_api_->Advance(base::TimeDelta::FromSeconds(1)); |
102 OnTaskSwitch(); | 102 OnTaskSwitch(); |
103 histogram_tester_->ExpectTotalCount(kHistogramName, 2); | 103 histogram_tester_->ExpectTotalCount(kHistogramName, 2); |
104 histogram_tester_->ExpectBucketCount(kHistogramName, 1, 1); | 104 histogram_tester_->ExpectBucketCount(kHistogramName, 1, 1); |
105 } | 105 } |
106 | 106 |
107 } // namespace ash | 107 } // namespace ash |
OLD | NEW |