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

Unified Diff: base/metrics/histogram_unittest.cc

Issue 1537743006: Persist setup metrics and have Chrome report them during UMA upload. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shared-histograms
Patch Set: test needs to clear out statistics-recorder before releasing histogram memory Created 4 years, 10 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
Index: base/metrics/histogram_unittest.cc
diff --git a/base/metrics/histogram_unittest.cc b/base/metrics/histogram_unittest.cc
index 784aaeb45a8ce0b0f70313fb380530a7514e20fd..70ce441a8b6d35ea11bdf1d4582ec9615f0c6a89 100644
--- a/base/metrics/histogram_unittest.cc
+++ b/base/metrics/histogram_unittest.cc
@@ -40,10 +40,6 @@ class HistogramTest : public testing::Test {
// Each test will have a clean state (no Histogram / BucketRanges
// registered).
InitializeStatisticsRecorder();
- // By getting the results-histogram before any persistent allocator
- // is attached, that histogram is guaranteed not to be stored in
- // any persistent memory segment (which simplifies some tests).
- GetCreateHistogramResultHistogram();
}
void TearDown() override {
@@ -62,10 +58,14 @@ class HistogramTest : public testing::Test {
}
void CreatePersistentMemoryAllocator() {
+ // By getting the results-histogram before any persistent allocator
+ // is attached, that histogram is guaranteed not to be stored in
+ // any persistent memory segment (which simplifies some tests).
+ GetCreateHistogramResultHistogram();
+
if (!allocator_memory_)
allocator_memory_.reset(new char[kAllocatorMemorySize]);
- SetPersistentHistogramMemoryAllocator(nullptr);
memset(allocator_memory_.get(), 0, kAllocatorMemorySize);
SetPersistentHistogramMemoryAllocator(
new PersistentMemoryAllocator(
@@ -76,7 +76,7 @@ class HistogramTest : public testing::Test {
void DestroyPersistentMemoryAllocator() {
allocator_ = nullptr;
- SetPersistentHistogramMemoryAllocator(nullptr);
+ delete ReleasePersistentHistogramMemoryAllocatorForTesting();
}
StatisticsRecorder* statistics_recorder_;

Powered by Google App Engine
This is Rietveld 408576698