Index: base/test/histogram_tester_unittest.cc |
diff --git a/base/test/histogram_tester_unittest.cc b/base/test/histogram_tester_unittest.cc |
index f8755279c5ac749612d95b0dacdd89bd66deeb04..153fe56312cf3a44a3d10da5964ef1498b3f5165 100644 |
--- a/base/test/histogram_tester_unittest.cc |
+++ b/base/test/histogram_tester_unittest.cc |
@@ -29,19 +29,32 @@ TEST_F(HistogramTesterTest, Scope) { |
HistogramTester tester; |
// Verify that no histogram is recorded. |
- scoped_ptr<HistogramSamples> samples( |
- tester.GetHistogramSamplesSinceCreation(kHistogram1)); |
- EXPECT_FALSE(samples); |
+ tester.ExpectTotalCount(kHistogram1, 0); |
// Record a histogram after the creation of the recorder. |
UMA_HISTOGRAM_BOOLEAN(kHistogram1, true); |
// Verify that one histogram is recorded. |
- samples = tester.GetHistogramSamplesSinceCreation(kHistogram1); |
+ scoped_ptr<HistogramSamples> samples( |
+ tester.GetHistogramSamplesSinceCreation(kHistogram1)); |
EXPECT_TRUE(samples); |
EXPECT_EQ(1, samples->TotalCount()); |
} |
+TEST_F(HistogramTesterTest, GetHistogramSamplesSinceCreationNotNull) { |
+ // Chose the histogram name uniquely, to ensure nothing was recorded for it so |
+ // far. |
+ const std::string kHistogram = |
+ "GetHistogramSamplesSinceCreationNotNullHistogram"; |
+ HistogramTester tester; |
+ |
+ // Verify that the returned samples are empty but not null. |
+ scoped_ptr<HistogramSamples> samples( |
+ tester.GetHistogramSamplesSinceCreation(kHistogram1)); |
+ EXPECT_TRUE(samples); |
+ tester.ExpectTotalCount(kHistogram, 0); |
+} |
+ |
TEST_F(HistogramTesterTest, TestUniqueSample) { |
HistogramTester tester; |