| 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..6f33c012bb6e2ad0dc41b0aebf772a479a1cb6b1 100644
|
| --- a/components/metrics/leak_detector/leak_detector_unittest.cc
|
| +++ b/components/metrics/leak_detector/leak_detector_unittest.cc
|
| @@ -6,8 +6,8 @@
|
|
|
| #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"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| @@ -59,17 +59,16 @@ 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
|
| - // test is over.
|
| - scoped_ptr<LeakDetector> detector_;
|
| + // Points to the instance of LeakDetector returned by GetInstance().
|
| + LeakDetector* detector_;
|
|
|
| private:
|
| // For supporting content::BrowserThread operations.
|
| @@ -106,10 +105,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}) {
|
|
|