OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/metrics/leak_detector/leak_detector_controller.h" | 5 #include "chrome/browser/metrics/leak_detector/leak_detector_controller.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 EXPECT_EQ(4U, proto.params().call_stack_suspicion_threshold()); | 76 EXPECT_EQ(4U, proto.params().call_stack_suspicion_threshold()); |
77 | 77 |
78 // No more reports. | 78 // No more reports. |
79 controller->GetLeakReports(&stored_reports); | 79 controller->GetLeakReports(&stored_reports); |
80 ASSERT_EQ(0U, stored_reports.size()); | 80 ASSERT_EQ(0U, stored_reports.size()); |
81 } | 81 } |
82 | 82 |
83 TEST(LeakDetectorControllerTest, SingleReportHistory) { | 83 TEST(LeakDetectorControllerTest, SingleReportHistory) { |
84 MemoryLeakReportProto report; | 84 MemoryLeakReportProto report; |
85 | 85 |
86 auto entry = report.add_alloc_breakdown_history(); | 86 auto* entry = report.add_alloc_breakdown_history(); |
87 InitializeRepeatedField({100, 200, 300}, entry->mutable_counts_by_size()); | 87 InitializeRepeatedField({100, 200, 300}, entry->mutable_counts_by_size()); |
88 entry->set_count_for_call_stack(15); | 88 entry->set_count_for_call_stack(15); |
89 | 89 |
90 entry = report.add_alloc_breakdown_history(); | 90 entry = report.add_alloc_breakdown_history(); |
91 InitializeRepeatedField({150, 250, 350, 650}, | 91 InitializeRepeatedField({150, 250, 350, 650}, |
92 entry->mutable_counts_by_size()); | 92 entry->mutable_counts_by_size()); |
93 entry->set_count_for_call_stack(30); | 93 entry->set_count_for_call_stack(30); |
94 | 94 |
95 entry = report.add_alloc_breakdown_history(); | 95 entry = report.add_alloc_breakdown_history(); |
96 InitializeRepeatedField({200, 300, 400, 700, 800}, | 96 InitializeRepeatedField({200, 300, 400, 700, 800}, |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 EXPECT_EQ(13U, stored_reports[2].call_stack().Get(4)); | 245 EXPECT_EQ(13U, stored_reports[2].call_stack().Get(4)); |
246 EXPECT_EQ(14U, stored_reports[2].call_stack().Get(5)); | 246 EXPECT_EQ(14U, stored_reports[2].call_stack().Get(5)); |
247 EXPECT_EQ(15U, stored_reports[2].call_stack().Get(6)); | 247 EXPECT_EQ(15U, stored_reports[2].call_stack().Get(6)); |
248 EXPECT_EQ(16U, stored_reports[2].call_stack().Get(7)); | 248 EXPECT_EQ(16U, stored_reports[2].call_stack().Get(7)); |
249 | 249 |
250 controller->GetLeakReports(&stored_reports); | 250 controller->GetLeakReports(&stored_reports); |
251 ASSERT_EQ(0U, stored_reports.size()); | 251 ASSERT_EQ(0U, stored_reports.size()); |
252 } | 252 } |
253 | 253 |
254 } // namespace metrics | 254 } // namespace metrics |
OLD | NEW |