| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/test/statistics_delta_reader.h" | |
| 6 | |
| 7 #include "base/memory/scoped_ptr.h" | |
| 8 #include "base/metrics/histogram.h" | |
| 9 #include "base/metrics/histogram_samples.h" | |
| 10 #include "testing/gtest/include/gtest/gtest.h" | |
| 11 | |
| 12 namespace base { | |
| 13 | |
| 14 TEST(StatisticsDeltaReaderTest, Scope) { | |
| 15 // Record a histogram before the creation of the recorder. | |
| 16 UMA_HISTOGRAM_BOOLEAN("Test", true); | |
| 17 | |
| 18 StatisticsDeltaReader reader; | |
| 19 | |
| 20 // Verify that no histogram is recorded. | |
| 21 scoped_ptr<HistogramSamples> samples( | |
| 22 reader.GetHistogramSamplesSinceCreation("Test")); | |
| 23 EXPECT_FALSE(samples); | |
| 24 | |
| 25 // Record a histogram after the creation of the recorder. | |
| 26 UMA_HISTOGRAM_BOOLEAN("Test", true); | |
| 27 | |
| 28 // Verify that one histogram is recorded. | |
| 29 samples = reader.GetHistogramSamplesSinceCreation("Test"); | |
| 30 EXPECT_TRUE(samples); | |
| 31 EXPECT_EQ(1, samples->TotalCount()); | |
| 32 } | |
| 33 | |
| 34 } // namespace base | |
| OLD | NEW |