| Index: base/metrics/statistics_recorder_unittest.cc
|
| diff --git a/base/metrics/statistics_recorder_unittest.cc b/base/metrics/statistics_recorder_unittest.cc
|
| index 29caf49110d9c799a944f587a055a7b23b7da2c4..5c457d103916183773098b0af52aac24bcb394e6 100644
|
| --- a/base/metrics/statistics_recorder_unittest.cc
|
| +++ b/base/metrics/statistics_recorder_unittest.cc
|
| @@ -23,7 +23,10 @@ class StatisticsRecorderTest : public testing::Test {
|
| InitializeStatisticsRecorder();
|
| }
|
|
|
| - void TearDown() override { UninitializeStatisticsRecorder(); }
|
| + void TearDown() override {
|
| + UninitializeStatisticsRecorder();
|
| + HistogramBase::SetDefaultPersistentMemoryAllocator(nullptr);
|
| + }
|
|
|
| void InitializeStatisticsRecorder() {
|
| statistics_recorder_ = new StatisticsRecorder();
|
| @@ -313,6 +316,23 @@ TEST_F(StatisticsRecorderTest, ToJSON) {
|
| EXPECT_TRUE(json.empty());
|
| }
|
|
|
| +TEST_F(StatisticsRecorderTest, IterationTest) {
|
| + StatisticsRecorder::Histograms registered_histograms;
|
| + LOCAL_HISTOGRAM_COUNTS("TestHistogram.IterationTest1", 30);
|
| + HistogramBase::SetDefaultPersistentMemoryAllocator(
|
| + new LocalPersistentMemoryAllocator(64 << 10, std::string()));
|
| + LOCAL_HISTOGRAM_COUNTS("TestHistogram.IterationTest2", 30);
|
| +
|
| + StatisticsRecorder::HistogramIterator i1 = StatisticsRecorder::begin(true);
|
| + EXPECT_NE(StatisticsRecorder::end(), i1);
|
| + EXPECT_NE(StatisticsRecorder::end(), ++i1);
|
| + EXPECT_EQ(StatisticsRecorder::end(), ++i1);
|
| +
|
| + StatisticsRecorder::HistogramIterator i2 = StatisticsRecorder::begin(false);
|
| + EXPECT_NE(StatisticsRecorder::end(), i2);
|
| + EXPECT_EQ(StatisticsRecorder::end(), ++i2);
|
| +}
|
| +
|
| namespace {
|
|
|
| // CallbackCheckWrapper is simply a convenient way to check and store that
|
|
|