| Index: base/metrics/histogram_unittest.cc
|
| diff --git a/base/metrics/histogram_unittest.cc b/base/metrics/histogram_unittest.cc
|
| index e7a01aa5af3d54bf1973f959822b1d989bd8417a..3ffe88d27a4594ad1fef8aa14fb1727877bb4c66 100644
|
| --- a/base/metrics/histogram_unittest.cc
|
| +++ b/base/metrics/histogram_unittest.cc
|
| @@ -443,6 +443,42 @@ TEST_F(HistogramTest, CustomHistogramSerializeInfo) {
|
| EXPECT_FALSE(iter.SkipBytes(1));
|
| }
|
|
|
| +TEST_F(HistogramTest, BadConstruction) {
|
| + HistogramBase* histogram = Histogram::FactoryGet(
|
| + "BadConstruction", 0, 100, 8,
|
| + HistogramBase::kNoFlags);
|
| + EXPECT_TRUE(
|
| + histogram->HasConstructionArguments(
|
| + 1, 100, 8));
|
| +
|
| + // Try to get the same histogram name with different arguments.
|
| + HistogramBase* bad_histogram = Histogram::FactoryGet(
|
| + "BadConstruction", 0, 100, 7,
|
| + HistogramBase::kNoFlags);
|
| + EXPECT_EQ(NULL, bad_histogram);
|
| + bad_histogram = Histogram::FactoryGet(
|
| + "BadConstruction", 0, 99, 8,
|
| + HistogramBase::kNoFlags);
|
| + EXPECT_EQ(NULL, bad_histogram);
|
| +
|
| + HistogramBase* linear_histogram = LinearHistogram::FactoryGet(
|
| + "BadConstructionLinear", 0, 100, 8,
|
| + HistogramBase::kNoFlags);
|
| + EXPECT_TRUE(
|
| + linear_histogram->HasConstructionArguments(
|
| + 1, 100, 8));
|
| +
|
| + // Try to get the same histogram name with different arguments.
|
| + bad_histogram = LinearHistogram::FactoryGet(
|
| + "BadConstructionLinear", 0, 100, 7,
|
| + HistogramBase::kNoFlags);
|
| + EXPECT_EQ(NULL, bad_histogram);
|
| + bad_histogram = LinearHistogram::FactoryGet(
|
| + "BadConstructionLinear", 10, 100, 8,
|
| + HistogramBase::kNoFlags);
|
| + EXPECT_EQ(NULL, bad_histogram);
|
| +}
|
| +
|
| #if GTEST_HAS_DEATH_TEST
|
| // For Histogram, LinearHistogram and CustomHistogram, the minimum for a
|
| // declared range is 1, while the maximum is (HistogramBase::kSampleType_MAX -
|
|
|