Chromium Code Reviews| Index: components/metrics/leak_detector/leak_detector_unittest.cc |
| diff --git a/components/metrics/leak_detector/leak_detector_unittest.cc b/components/metrics/leak_detector/leak_detector_unittest.cc |
| index a134a17b130bc2000c659e12f28c0890b580ca8e..e29a0e000e760b6baa9f30793779e2ef12d7fa9d 100644 |
| --- a/components/metrics/leak_detector/leak_detector_unittest.cc |
| +++ b/components/metrics/leak_detector/leak_detector_unittest.cc |
| @@ -6,6 +6,7 @@ |
| #include <set> |
| +#include "base/allocator/allocator_extension.h" |
| #include "base/macros.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "content/public/test/test_browser_thread_bundle.h" |
| @@ -59,17 +60,17 @@ class TestObserver : public LeakDetector::Observer { |
| class LeakDetectorTest : public ::testing::Test { |
| public: |
| - LeakDetectorTest() |
| - : detector_(new LeakDetector(kDefaultSamplingRate, |
| - kDefaultMaxCallStackUnwindDepth, |
| - kDefaultAnalysisIntervalBytes, |
| - kDefaultSizeSuspicionThreshold, |
| - kDefaultCallStackSuspicionThreshold)) {} |
| + LeakDetectorTest() : detector_(LeakDetector::GetInstance()) { |
| + detector_->Init(kDefaultSamplingRate, kDefaultMaxCallStackUnwindDepth, |
| + kDefaultAnalysisIntervalBytes, |
| + kDefaultSizeSuspicionThreshold, |
| + kDefaultCallStackSuspicionThreshold); |
| + } |
| protected: |
| // Use a scoped_ptr to hold the test object so it can be destroyed before the |
|
Will Harris
2016/03/12 01:44:22
nit:update comment
Simon Que
2016/03/14 19:17:01
Done.
|
| // test is over. |
| - scoped_ptr<LeakDetector> detector_; |
| + LeakDetector* detector_; |
| private: |
| // For supporting content::BrowserThread operations. |
| @@ -106,10 +107,6 @@ TEST_F(LeakDetectorTest, NotifyObservers) { |
| detector_->NotifyObservers(reports1); |
| detector_->NotifyObservers(reports2); |
| - // Shut down the leak detector before checking the reports, so that the |
| - // stored reports can be examined without new reports being generated. |
| - detector_.reset(); |
| - |
| // Check that all three observers got both sets of reports, passed in |
| // separately. |
| for (const TestObserver* obs : {&obs1, &obs2, &obs3}) { |