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/histogram_manager.h" | 5 #include "components/cronet/histogram_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 namespace metrics { | 12 namespace metrics { |
13 | 13 |
14 // TODO(mef): crbug.com/441441. Move components/metrics/histogram_manager.* | |
15 // files into components/android/cronet. | |
16 // TODO(rtenneti): enable flaky HistogramBucketFields unit test. | 14 // TODO(rtenneti): enable flaky HistogramBucketFields unit test. |
17 TEST(HistogramManager, DISABLED_HistogramBucketFields) { | 15 TEST(HistogramManager, DISABLED_HistogramBucketFields) { |
Alexei Svitkine (slow)
2015/04/08 17:56:37
Any idea why this is still disabled/flaky? Are you
mef
2015/04/08 18:06:04
Good question, I probably should, although I'm not
ramant (doing other things)
2015/04/08 18:22:13
I don't remember. Is it possible try LOCAL_HISTOGR
| |
18 // Capture histograms at the start of the test to avoid later GetDeltas() | 16 // Capture histograms at the start of the test to avoid later GetDeltas() |
19 // calls picking them up. | 17 // calls picking them up. |
20 std::vector<uint8> data_init; | 18 std::vector<uint8> data_init; |
21 HistogramManager::GetInstance()->GetDeltas(&data_init); | 19 HistogramManager::GetInstance()->GetDeltas(&data_init); |
22 | 20 |
23 // kNoFlags filter should record all histograms. | 21 // kNoFlags filter should record all histograms. |
24 UMA_HISTOGRAM_ENUMERATION("UmaHistogramManager", 1, 2); | 22 UMA_HISTOGRAM_ENUMERATION("UmaHistogramManager", 1, 2); |
mef
2015/04/08 18:06:04
I've got presubmit warning that "UmaHistogramManag
Alexei Svitkine (slow)
2015/04/08 18:11:38
Hmm, the presubmit should probably be ignoring _un
Alexei Svitkine (slow)
2015/04/08 18:12:07
Correct link: https://code.google.com/p/chromium/c
| |
25 | 23 |
26 std::vector<uint8> data; | 24 std::vector<uint8> data; |
27 EXPECT_TRUE(HistogramManager::GetInstance()->GetDeltas(&data)); | 25 EXPECT_TRUE(HistogramManager::GetInstance()->GetDeltas(&data)); |
28 EXPECT_FALSE(data.empty()); | 26 EXPECT_FALSE(data.empty()); |
29 ChromeUserMetricsExtension uma_proto; | 27 ChromeUserMetricsExtension uma_proto; |
30 EXPECT_TRUE(uma_proto.ParseFromArray( | 28 EXPECT_TRUE(uma_proto.ParseFromArray( |
31 reinterpret_cast<const char*>(&data[0]), data.size())); | 29 reinterpret_cast<const char*>(&data[0]), data.size())); |
32 EXPECT_FALSE(data.empty()); | 30 EXPECT_FALSE(data.empty()); |
33 | 31 |
34 const HistogramEventProto& histogram_proto = | 32 const HistogramEventProto& histogram_proto = |
(...skipping 14 matching lines...) Expand all Loading... | |
49 | 47 |
50 const HistogramEventProto& histogram_proto2 = | 48 const HistogramEventProto& histogram_proto2 = |
51 uma_proto2.histogram_event(uma_proto2.histogram_event_size() - 1); | 49 uma_proto2.histogram_event(uma_proto2.histogram_event_size() - 1); |
52 ASSERT_EQ(1, histogram_proto2.bucket_size()); | 50 ASSERT_EQ(1, histogram_proto2.bucket_size()); |
53 EXPECT_LE(0, histogram_proto2.bucket(0).min()); | 51 EXPECT_LE(0, histogram_proto2.bucket(0).min()); |
54 EXPECT_LE(3, histogram_proto2.bucket(0).max()); | 52 EXPECT_LE(3, histogram_proto2.bucket(0).max()); |
55 EXPECT_EQ(1, histogram_proto2.bucket(0).count()); | 53 EXPECT_EQ(1, histogram_proto2.bucket(0).count()); |
56 } | 54 } |
57 | 55 |
58 } // namespace metrics | 56 } // namespace metrics |
OLD | NEW |