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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/metrics/bucket_ranges.h" | 8 #include "base/metrics/bucket_ranges.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/metrics/sample_vector.h" | 10 #include "base/metrics/sample_vector.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 EXPECT_DEATH(samples1.Add(samples2), ""); | 161 EXPECT_DEATH(samples1.Add(samples2), ""); |
162 EXPECT_DEATH(samples1.Subtract(samples2), ""); | 162 EXPECT_DEATH(samples1.Subtract(samples2), ""); |
163 | 163 |
164 // Bucket not match: [3, 5) VS [3, 6) | 164 // Bucket not match: [3, 5) VS [3, 6) |
165 samples2.Accumulate(6, -100); | 165 samples2.Accumulate(6, -100); |
166 samples2.Accumulate(3, 100); | 166 samples2.Accumulate(3, 100); |
167 EXPECT_DEATH(samples1.Add(samples2), ""); | 167 EXPECT_DEATH(samples1.Add(samples2), ""); |
168 EXPECT_DEATH(samples1.Subtract(samples2), ""); | 168 EXPECT_DEATH(samples1.Subtract(samples2), ""); |
169 } | 169 } |
170 | 170 |
| 171 #endif |
171 // (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) && GTEST_HAS_DEATH_TEST | 172 // (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) && GTEST_HAS_DEATH_TEST |
172 #endif | |
173 | 173 |
174 TEST(SampleVectorIteratorTest, IterateTest) { | 174 TEST(SampleVectorIteratorTest, IterateTest) { |
175 BucketRanges ranges(5); | 175 BucketRanges ranges(5); |
176 ranges.set_range(0, 0); | 176 ranges.set_range(0, 0); |
177 ranges.set_range(1, 1); | 177 ranges.set_range(1, 1); |
178 ranges.set_range(2, 2); | 178 ranges.set_range(2, 2); |
179 ranges.set_range(3, 3); | 179 ranges.set_range(3, 3); |
180 ranges.set_range(4, 4); | 180 ranges.set_range(4, 4); |
181 | 181 |
182 vector<HistogramBase::Count> counts(3); | 182 vector<HistogramBase::Count> counts(3); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 HistogramBase::Count count; | 251 HistogramBase::Count count; |
252 EXPECT_DEATH(it->Get(&min, &max, &count), ""); | 252 EXPECT_DEATH(it->Get(&min, &max, &count), ""); |
253 | 253 |
254 EXPECT_DEATH(it->Next(), ""); | 254 EXPECT_DEATH(it->Next(), ""); |
255 | 255 |
256 samples.Accumulate(2, 100); | 256 samples.Accumulate(2, 100); |
257 it = samples.Iterator(); | 257 it = samples.Iterator(); |
258 EXPECT_FALSE(it->Done()); | 258 EXPECT_FALSE(it->Done()); |
259 } | 259 } |
260 | 260 |
| 261 #endif |
261 // (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) && GTEST_HAS_DEATH_TEST | 262 // (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) && GTEST_HAS_DEATH_TEST |
262 #endif | |
263 | 263 |
264 } // namespace | 264 } // namespace |
265 } // namespace base | 265 } // namespace base |
OLD | NEW |