OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "platform/scheduler/renderer/task_duration_metric_reporter.h" | 5 #include "platform/scheduler/renderer/task_duration_metric_reporter.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/metrics/histogram_base.h" | 8 #include "base/metrics/histogram_base.h" |
9 #include "base/metrics/histogram_samples.h" | 9 #include "base/metrics/histogram_samples.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 namespace scheduler { | 15 namespace scheduler { |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 using testing::_; | 19 using ::testing::_; |
20 using testing::Mock; | 20 using ::testing::Mock; |
21 | 21 |
22 class FakeHistogram : public base::HistogramBase { | 22 class FakeHistogram : public base::HistogramBase { |
23 public: | 23 public: |
24 FakeHistogram() : base::HistogramBase("fake") {} | 24 FakeHistogram() : base::HistogramBase("fake") {} |
25 ~FakeHistogram() override = default; | 25 ~FakeHistogram() override = default; |
26 | 26 |
27 MOCK_METHOD2(AddCount, void(base::HistogramBase::Sample, int)); | 27 MOCK_METHOD2(AddCount, void(base::HistogramBase::Sample, int)); |
28 MOCK_CONST_METHOD0(name_hash, uint64_t()); | 28 MOCK_CONST_METHOD0(name_hash, uint64_t()); |
29 MOCK_CONST_METHOD0(GetHistogramType, base::HistogramType()); | 29 MOCK_CONST_METHOD0(GetHistogramType, base::HistogramType()); |
30 MOCK_CONST_METHOD3(HasConstructionArguments, | 30 MOCK_CONST_METHOD3(HasConstructionArguments, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 Mock::VerifyAndClearExpectations(&histogram); | 72 Mock::VerifyAndClearExpectations(&histogram); |
73 | 73 |
74 EXPECT_CALL(histogram, AddCount(2, 16)); | 74 EXPECT_CALL(histogram, AddCount(2, 16)); |
75 metric_reporter.RecordTask(static_cast<TaskQueue::QueueType>(2), | 75 metric_reporter.RecordTask(static_cast<TaskQueue::QueueType>(2), |
76 base::TimeDelta::FromMicroseconds(15600)); | 76 base::TimeDelta::FromMicroseconds(15600)); |
77 Mock::VerifyAndClearExpectations(&histogram); | 77 Mock::VerifyAndClearExpectations(&histogram); |
78 } | 78 } |
79 | 79 |
80 } // namespace scheduler | 80 } // namespace scheduler |
81 } // namespace blink | 81 } // namespace blink |
OLD | NEW |