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 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 const BucketRanges* ranges = custom_histogram->bucket_ranges(); | 730 const BucketRanges* ranges = custom_histogram->bucket_ranges(); |
731 ASSERT_EQ(3u, ranges->size()); | 731 ASSERT_EQ(3u, ranges->size()); |
732 EXPECT_EQ(0, ranges->range(0)); | 732 EXPECT_EQ(0, ranges->range(0)); |
733 EXPECT_EQ(5, ranges->range(1)); | 733 EXPECT_EQ(5, ranges->range(1)); |
734 EXPECT_EQ(HistogramBase::kSampleType_MAX, ranges->range(2)); | 734 EXPECT_EQ(HistogramBase::kSampleType_MAX, ranges->range(2)); |
735 | 735 |
736 // CustomHistogram does not accepts kSampleType_MAX as range. | 736 // CustomHistogram does not accepts kSampleType_MAX as range. |
737 custom_ranges.push_back(HistogramBase::kSampleType_MAX); | 737 custom_ranges.push_back(HistogramBase::kSampleType_MAX); |
738 EXPECT_DCHECK_DEATH( | 738 EXPECT_DCHECK_DEATH( |
739 CustomHistogram::FactoryGet("BadRangesCustom2", custom_ranges, | 739 CustomHistogram::FactoryGet("BadRangesCustom2", custom_ranges, |
740 HistogramBase::kNoFlags), | 740 HistogramBase::kNoFlags)); |
741 ""); | |
742 | 741 |
743 // CustomHistogram needs at least 1 valid range. | 742 // CustomHistogram needs at least 1 valid range. |
744 custom_ranges.clear(); | 743 custom_ranges.clear(); |
745 custom_ranges.push_back(0); | 744 custom_ranges.push_back(0); |
746 EXPECT_DCHECK_DEATH( | 745 EXPECT_DCHECK_DEATH( |
747 CustomHistogram::FactoryGet("BadRangesCustom3", custom_ranges, | 746 CustomHistogram::FactoryGet("BadRangesCustom3", custom_ranges, |
748 HistogramBase::kNoFlags), | 747 HistogramBase::kNoFlags)); |
749 ""); | |
750 } | 748 } |
751 | 749 |
752 } // namespace base | 750 } // namespace base |
OLD | NEW |