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

Unified Diff: base/metrics/statistics_recorder_unittest.cc

Issue 1779503002: Fix StatisticsRecorder to handle re-entry during tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: always do global UninitializeForTesting when uninitializing Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/metrics/statistics_recorder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/statistics_recorder_unittest.cc
diff --git a/base/metrics/statistics_recorder_unittest.cc b/base/metrics/statistics_recorder_unittest.cc
index 6be7d5bb881a893791f45c83e8ff552ffa69d452..aede0b11fbfd56f8b074024250fc56638dc1a94b 100644
--- a/base/metrics/statistics_recorder_unittest.cc
+++ b/base/metrics/statistics_recorder_unittest.cc
@@ -36,12 +36,14 @@ class StatisticsRecorderTest : public testing::Test {
}
void InitializeStatisticsRecorder() {
- statistics_recorder_ = new StatisticsRecorder();
+ DCHECK(!statistics_recorder_);
+ StatisticsRecorder::UninitializeForTesting();
+ statistics_recorder_.reset(new StatisticsRecorder());
}
void UninitializeStatisticsRecorder() {
- delete statistics_recorder_;
- statistics_recorder_ = NULL;
+ statistics_recorder_.reset();
+ StatisticsRecorder::UninitializeForTesting();
}
Histogram* CreateHistogram(const std::string& name,
@@ -59,7 +61,7 @@ class StatisticsRecorderTest : public testing::Test {
delete histogram;
}
- StatisticsRecorder* statistics_recorder_;
+ std::unique_ptr<StatisticsRecorder> statistics_recorder_;
};
TEST_F(StatisticsRecorderTest, NotInitialized) {
« no previous file with comments | « base/metrics/statistics_recorder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698