Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Side by Side Diff: components/metrics/histogram_encoder_unittest.cc

Issue 1548113002: Switch to standard integer types in components/, part 2 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gn Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/metrics/histogram_encoder.h" 5 #include "components/metrics/histogram_encoder.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h"
10 #include "base/metrics/bucket_ranges.h" 9 #include "base/metrics/bucket_ranges.h"
11 #include "base/metrics/sample_vector.h" 10 #include "base/metrics/sample_vector.h"
12 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
13 12
14 namespace metrics { 13 namespace metrics {
15 14
16 TEST(HistogramEncoder, HistogramBucketFields) { 15 TEST(HistogramEncoder, HistogramBucketFields) {
17 // Create buckets: 1-5, 5-7, 7-8, 8-9, 9-10, 10-11, 11-12. 16 // Create buckets: 1-5, 5-7, 7-8, 8-9, 9-10, 10-11, 11-12.
18 base::BucketRanges ranges(8); 17 base::BucketRanges ranges(8);
19 ranges.set_range(0, 1); 18 ranges.set_range(0, 1);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 EXPECT_FALSE(histogram_proto.bucket(3).has_max()); 62 EXPECT_FALSE(histogram_proto.bucket(3).has_max());
64 EXPECT_EQ(10, histogram_proto.bucket(3).min()); 63 EXPECT_EQ(10, histogram_proto.bucket(3).min());
65 64
66 // 11-12 becomes /-12 (last record must keep max, min is same as max - 1). 65 // 11-12 becomes /-12 (last record must keep max, min is same as max - 1).
67 EXPECT_FALSE(histogram_proto.bucket(4).has_min()); 66 EXPECT_FALSE(histogram_proto.bucket(4).has_min());
68 EXPECT_TRUE(histogram_proto.bucket(4).has_max()); 67 EXPECT_TRUE(histogram_proto.bucket(4).has_max());
69 EXPECT_EQ(12, histogram_proto.bucket(4).max()); 68 EXPECT_EQ(12, histogram_proto.bucket(4).max());
70 } 69 }
71 70
72 } // namespace metrics 71 } // namespace metrics
OLDNEW
« no previous file with comments | « components/metrics/histogram_encoder.cc ('k') | components/metrics/leak_detector/call_stack_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698