| 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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 int range; | 567 int range; |
| 568 EXPECT_TRUE(iter.ReadInt(&range)); | 568 EXPECT_TRUE(iter.ReadInt(&range)); |
| 569 EXPECT_EQ(10, range); | 569 EXPECT_EQ(10, range); |
| 570 EXPECT_TRUE(iter.ReadInt(&range)); | 570 EXPECT_TRUE(iter.ReadInt(&range)); |
| 571 EXPECT_EQ(100, range); | 571 EXPECT_EQ(100, range); |
| 572 | 572 |
| 573 // No more data in the pickle. | 573 // No more data in the pickle. |
| 574 EXPECT_FALSE(iter.SkipBytes(1)); | 574 EXPECT_FALSE(iter.SkipBytes(1)); |
| 575 } | 575 } |
| 576 | 576 |
| 577 TEST_P(HistogramTest, DISABLED_BadConstruction) { | 577 TEST_P(HistogramTest, BadConstruction) { |
| 578 HistogramBase* histogram = Histogram::FactoryGet( | 578 HistogramBase* histogram = Histogram::FactoryGet( |
| 579 "BadConstruction", 0, 100, 8, HistogramBase::kNoFlags); | 579 "BadConstruction", 0, 100, 8, HistogramBase::kNoFlags); |
| 580 EXPECT_TRUE(histogram->HasConstructionArguments(1, 100, 8)); | 580 EXPECT_TRUE(histogram->HasConstructionArguments(1, 100, 8)); |
| 581 | 581 |
| 582 // Try to get the same histogram name with different arguments. | 582 // Try to get the same histogram name with different arguments. |
| 583 HistogramBase* bad_histogram = Histogram::FactoryGet( | 583 HistogramBase* bad_histogram = Histogram::FactoryGet( |
| 584 "BadConstruction", 0, 100, 7, HistogramBase::kNoFlags); | 584 "BadConstruction", 0, 100, 7, HistogramBase::kNoFlags); |
| 585 EXPECT_EQ(NULL, bad_histogram); | 585 EXPECT_EQ(NULL, bad_histogram); |
| 586 bad_histogram = Histogram::FactoryGet( | 586 bad_histogram = Histogram::FactoryGet( |
| 587 "BadConstruction", 0, 99, 8, HistogramBase::kNoFlags); | 587 "BadConstruction", 0, 99, 8, HistogramBase::kNoFlags); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 // CustomHistogram needs at least 1 valid range. | 703 // CustomHistogram needs at least 1 valid range. |
| 704 custom_ranges.clear(); | 704 custom_ranges.clear(); |
| 705 custom_ranges.push_back(0); | 705 custom_ranges.push_back(0); |
| 706 EXPECT_DEATH(CustomHistogram::FactoryGet("BadRangesCustom3", custom_ranges, | 706 EXPECT_DEATH(CustomHistogram::FactoryGet("BadRangesCustom3", custom_ranges, |
| 707 HistogramBase::kNoFlags), | 707 HistogramBase::kNoFlags), |
| 708 ""); | 708 ""); |
| 709 } | 709 } |
| 710 #endif | 710 #endif |
| 711 | 711 |
| 712 } // namespace base | 712 } // namespace base |
| OLD | NEW |