Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: chrome/browser/metrics/leak_detector/leak_detector_controller_unittest.cc

Issue 2396743002: Leak reports collect information about the memory usage (Closed)
Patch Set: Make the unit tests pass Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 14 matching lines...) Expand all
25 *output = ::google::protobuf::RepeatedField<T>(input.begin(), input.end()); 25 *output = ::google::protobuf::RepeatedField<T>(input.begin(), input.end());
26 } 26 }
27 27
28 } // namespace 28 } // namespace
29 29
30 // Test class for LeakDetectorController that exposes protected methods. 30 // Test class for LeakDetectorController that exposes protected methods.
31 class TestLeakDetectorController : public LeakDetectorController { 31 class TestLeakDetectorController : public LeakDetectorController {
32 public: 32 public:
33 using LeakDetectorController::OnLeaksFound; 33 using LeakDetectorController::OnLeaksFound;
34 34
35 TestLeakDetectorController() {} 35 // This constructor suppresses starting memory metrics job in the superclass.
36 TestLeakDetectorController() {
37 LeakDetectorController::waiting_for_collect_memory_usage_ = true;
Simon Que 2016/10/07 06:24:58 You have the right idea but this is not the best d
mwlodar 2016/10/07 18:54:35 Done.
38 }
36 39
37 private: 40 private:
38 DISALLOW_COPY_AND_ASSIGN(TestLeakDetectorController); 41 DISALLOW_COPY_AND_ASSIGN(TestLeakDetectorController);
39 }; 42 };
40 43
41 class LeakDetectorControllerTest : public ::testing::Test { 44 class LeakDetectorControllerTest : public ::testing::Test {
42 public: 45 public:
43 LeakDetectorControllerTest() {} 46 LeakDetectorControllerTest() {}
44 47
45 private: 48 private:
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 EXPECT_EQ(13U, stored_reports[2].call_stack().Get(4)); 260 EXPECT_EQ(13U, stored_reports[2].call_stack().Get(4));
258 EXPECT_EQ(14U, stored_reports[2].call_stack().Get(5)); 261 EXPECT_EQ(14U, stored_reports[2].call_stack().Get(5));
259 EXPECT_EQ(15U, stored_reports[2].call_stack().Get(6)); 262 EXPECT_EQ(15U, stored_reports[2].call_stack().Get(6));
260 EXPECT_EQ(16U, stored_reports[2].call_stack().Get(7)); 263 EXPECT_EQ(16U, stored_reports[2].call_stack().Get(7));
261 264
262 controller->GetLeakReports(&stored_reports); 265 controller->GetLeakReports(&stored_reports);
263 ASSERT_EQ(0U, stored_reports.size()); 266 ASSERT_EQ(0U, stored_reports.size());
264 } 267 }
265 268
266 } // namespace metrics 269 } // namespace metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698