| 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/sample_map.h" | 5 #include "base/metrics/sample_map.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 137 |
| 138 it->Get(&min, &max, &count); | 138 it->Get(&min, &max, &count); |
| 139 EXPECT_EQ(15, min); | 139 EXPECT_EQ(15, min); |
| 140 EXPECT_EQ(16, max); | 140 EXPECT_EQ(16, max); |
| 141 EXPECT_EQ(3, count); | 141 EXPECT_EQ(3, count); |
| 142 | 142 |
| 143 it->Next(); | 143 it->Next(); |
| 144 EXPECT_TRUE(it->Done()); | 144 EXPECT_TRUE(it->Done()); |
| 145 } | 145 } |
| 146 | 146 |
| 147 #if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) && GTEST_HAS_DEATH_TEST | 147 #if DCHECK_IS_ON() && GTEST_HAS_DEATH_TEST |
| 148 | 148 |
| 149 TEST(SampleMapIteratorDeathTest, IterateDoneTest) { | 149 TEST(SampleMapIteratorDeathTest, IterateDoneTest) { |
| 150 SampleMap samples(1); | 150 SampleMap samples(1); |
| 151 | 151 |
| 152 std::unique_ptr<SampleCountIterator> it = samples.Iterator(); | 152 std::unique_ptr<SampleCountIterator> it = samples.Iterator(); |
| 153 | 153 |
| 154 EXPECT_TRUE(it->Done()); | 154 EXPECT_TRUE(it->Done()); |
| 155 | 155 |
| 156 HistogramBase::Sample min; | 156 HistogramBase::Sample min; |
| 157 HistogramBase::Sample max; | 157 HistogramBase::Sample max; |
| 158 HistogramBase::Count count; | 158 HistogramBase::Count count; |
| 159 EXPECT_DEATH(it->Get(&min, &max, &count), ""); | 159 EXPECT_DEATH(it->Get(&min, &max, &count), ""); |
| 160 | 160 |
| 161 EXPECT_DEATH(it->Next(), ""); | 161 EXPECT_DEATH(it->Next(), ""); |
| 162 | 162 |
| 163 samples.Accumulate(1, 100); | 163 samples.Accumulate(1, 100); |
| 164 it = samples.Iterator(); | 164 it = samples.Iterator(); |
| 165 EXPECT_FALSE(it->Done()); | 165 EXPECT_FALSE(it->Done()); |
| 166 } | 166 } |
| 167 | 167 |
| 168 #endif | 168 #endif |
| 169 // (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) && GTEST_HAS_DEATH_TEST | 169 // DCHECK_IS_ON() && GTEST_HAS_DEATH_TEST |
| 170 | 170 |
| 171 } // namespace | 171 } // namespace |
| 172 } // namespace base | 172 } // namespace base |
| OLD | NEW |