OLD | NEW |
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 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 int range; | 661 int range; |
662 EXPECT_TRUE(iter.ReadInt(&range)); | 662 EXPECT_TRUE(iter.ReadInt(&range)); |
663 EXPECT_EQ(10, range); | 663 EXPECT_EQ(10, range); |
664 EXPECT_TRUE(iter.ReadInt(&range)); | 664 EXPECT_TRUE(iter.ReadInt(&range)); |
665 EXPECT_EQ(100, range); | 665 EXPECT_EQ(100, range); |
666 | 666 |
667 // No more data in the pickle. | 667 // No more data in the pickle. |
668 EXPECT_FALSE(iter.SkipBytes(1)); | 668 EXPECT_FALSE(iter.SkipBytes(1)); |
669 } | 669 } |
670 | 670 |
671 TEST_P(HistogramTest, DISABLED_BadConstruction) { | 671 TEST_P(HistogramTest, BadConstruction) { |
672 HistogramBase* histogram = Histogram::FactoryGet( | 672 HistogramBase* histogram = Histogram::FactoryGet( |
673 "BadConstruction", 0, 100, 8, HistogramBase::kNoFlags); | 673 "BadConstruction", 0, 100, 8, HistogramBase::kNoFlags); |
674 EXPECT_TRUE(histogram->HasConstructionArguments(1, 100, 8)); | 674 EXPECT_TRUE(histogram->HasConstructionArguments(1, 100, 8)); |
675 | 675 |
676 // Try to get the same histogram name with different arguments. | 676 // Try to get the same histogram name with different arguments. |
677 HistogramBase* bad_histogram = Histogram::FactoryGet( | 677 HistogramBase* bad_histogram = Histogram::FactoryGet( |
678 "BadConstruction", 0, 100, 7, HistogramBase::kNoFlags); | 678 "BadConstruction", 0, 100, 7, HistogramBase::kNoFlags); |
679 EXPECT_EQ(NULL, bad_histogram); | 679 EXPECT_EQ(NULL, bad_histogram); |
680 bad_histogram = Histogram::FactoryGet( | 680 bad_histogram = Histogram::FactoryGet( |
681 "BadConstruction", 0, 99, 8, HistogramBase::kNoFlags); | 681 "BadConstruction", 0, 99, 8, HistogramBase::kNoFlags); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 // CustomHistogram needs at least 1 valid range. | 797 // CustomHistogram needs at least 1 valid range. |
798 custom_ranges.clear(); | 798 custom_ranges.clear(); |
799 custom_ranges.push_back(0); | 799 custom_ranges.push_back(0); |
800 EXPECT_DEATH(CustomHistogram::FactoryGet("BadRangesCustom3", custom_ranges, | 800 EXPECT_DEATH(CustomHistogram::FactoryGet("BadRangesCustom3", custom_ranges, |
801 HistogramBase::kNoFlags), | 801 HistogramBase::kNoFlags), |
802 ""); | 802 ""); |
803 } | 803 } |
804 #endif | 804 #endif |
805 | 805 |
806 } // namespace base | 806 } // namespace base |
OLD | NEW |