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

Side by Side Diff: base/metrics/histogram_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: Created 4 years, 9 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
« no previous file with comments | « no previous file | base/metrics/statistics_recorder.h » ('j') | base/metrics/statistics_recorder.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/metrics/histogram.h" 5 #include "base/metrics/histogram.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 void TearDown() override { 47 void TearDown() override {
48 if (allocator_) { 48 if (allocator_) {
49 ASSERT_FALSE(allocator_->IsFull()); 49 ASSERT_FALSE(allocator_->IsFull());
50 ASSERT_FALSE(allocator_->IsCorrupt()); 50 ASSERT_FALSE(allocator_->IsCorrupt());
51 } 51 }
52 UninitializeStatisticsRecorder(); 52 UninitializeStatisticsRecorder();
53 DestroyPersistentMemoryAllocator(); 53 DestroyPersistentMemoryAllocator();
54 } 54 }
55 55
56 void InitializeStatisticsRecorder() { 56 void InitializeStatisticsRecorder() {
57 StatisticsRecorder::ResetForTesting();
58 statistics_recorder_ = new StatisticsRecorder(); 57 statistics_recorder_ = new StatisticsRecorder();
59 } 58 }
60 59
61 void UninitializeStatisticsRecorder() { 60 void UninitializeStatisticsRecorder() {
62 delete statistics_recorder_; 61 delete statistics_recorder_;
63 statistics_recorder_ = NULL; 62 statistics_recorder_ = NULL;
64 } 63 }
65 64
66 void CreatePersistentMemoryAllocator() { 65 void CreatePersistentMemoryAllocator() {
67 // By getting the results-histogram before any persistent allocator 66 // By getting the results-histogram before any persistent allocator
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 // CustomHistogram needs at least 1 valid range. 796 // CustomHistogram needs at least 1 valid range.
798 custom_ranges.clear(); 797 custom_ranges.clear();
799 custom_ranges.push_back(0); 798 custom_ranges.push_back(0);
800 EXPECT_DEATH(CustomHistogram::FactoryGet("BadRangesCustom3", custom_ranges, 799 EXPECT_DEATH(CustomHistogram::FactoryGet("BadRangesCustom3", custom_ranges,
801 HistogramBase::kNoFlags), 800 HistogramBase::kNoFlags),
802 ""); 801 "");
803 } 802 }
804 #endif 803 #endif
805 804
806 } // namespace base 805 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/metrics/statistics_recorder.h » ('j') | base/metrics/statistics_recorder.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698