| OLD | NEW |
| 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/metrics_log.h" | 5 #include "components/metrics/metrics_log.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 base::BucketRanges ranges(8); | 185 base::BucketRanges ranges(8); |
| 186 ranges.set_range(0, 1); | 186 ranges.set_range(0, 1); |
| 187 ranges.set_range(1, 5); | 187 ranges.set_range(1, 5); |
| 188 ranges.set_range(2, 7); | 188 ranges.set_range(2, 7); |
| 189 ranges.set_range(3, 8); | 189 ranges.set_range(3, 8); |
| 190 ranges.set_range(4, 9); | 190 ranges.set_range(4, 9); |
| 191 ranges.set_range(5, 10); | 191 ranges.set_range(5, 10); |
| 192 ranges.set_range(6, 11); | 192 ranges.set_range(6, 11); |
| 193 ranges.set_range(7, 12); | 193 ranges.set_range(7, 12); |
| 194 | 194 |
| 195 base::SampleVector samples(&ranges); | 195 base::SampleVector samples(1, &ranges); |
| 196 samples.Accumulate(3, 1); // Bucket 1-5. | 196 samples.Accumulate(3, 1); // Bucket 1-5. |
| 197 samples.Accumulate(6, 1); // Bucket 5-7. | 197 samples.Accumulate(6, 1); // Bucket 5-7. |
| 198 samples.Accumulate(8, 1); // Bucket 8-9. (7-8 skipped) | 198 samples.Accumulate(8, 1); // Bucket 8-9. (7-8 skipped) |
| 199 samples.Accumulate(10, 1); // Bucket 10-11. (9-10 skipped) | 199 samples.Accumulate(10, 1); // Bucket 10-11. (9-10 skipped) |
| 200 samples.Accumulate(11, 1); // Bucket 11-12. | 200 samples.Accumulate(11, 1); // Bucket 11-12. |
| 201 | 201 |
| 202 TestMetricsServiceClient client; | 202 TestMetricsServiceClient client; |
| 203 TestingPrefServiceSimple prefs; | 203 TestingPrefServiceSimple prefs; |
| 204 TestMetricsLog log( | 204 TestMetricsLog log( |
| 205 kClientId, kSessionId, MetricsLog::ONGOING_LOG, &client, &prefs_); | 205 kClientId, kSessionId, MetricsLog::ONGOING_LOG, &client, &prefs_); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 TestMetricsServiceClient client; | 415 TestMetricsServiceClient client; |
| 416 client.set_product(kTestProduct); | 416 client.set_product(kTestProduct); |
| 417 TestMetricsLog log( | 417 TestMetricsLog log( |
| 418 kClientId, kSessionId, MetricsLog::ONGOING_LOG, &client, &prefs_); | 418 kClientId, kSessionId, MetricsLog::ONGOING_LOG, &client, &prefs_); |
| 419 // Check that the product is set to |kTestProduct|. | 419 // Check that the product is set to |kTestProduct|. |
| 420 EXPECT_TRUE(log.uma_proto().has_product()); | 420 EXPECT_TRUE(log.uma_proto().has_product()); |
| 421 EXPECT_EQ(kTestProduct, log.uma_proto().product()); | 421 EXPECT_EQ(kTestProduct, log.uma_proto().product()); |
| 422 } | 422 } |
| 423 | 423 |
| 424 } // namespace metrics | 424 } // namespace metrics |
| OLD | NEW |