OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <map> | 5 #include <map> |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // Code other than the tests tun here will record some histogram values, but | 116 // Code other than the tests tun here will record some histogram values, but |
117 // we will ignore those. This function validates that all the histogram we | 117 // we will ignore those. This function validates that all the histogram we |
118 // expect to see are present in the list, and that their basic info is | 118 // expect to see are present in the list, and that their basic info is |
119 // correct. | 119 // correct. |
120 for (int i = 0; i < count; ++i) { | 120 for (int i = 0; i < count; ++i) { |
121 const RecordedHistogram& r = recorded[i]; | 121 const RecordedHistogram& r = recorded[i]; |
122 std::string name(BuildFullName(r.name, extension)); | 122 std::string name(BuildFullName(r.name, extension)); |
123 | 123 |
124 size_t j = 0; | 124 size_t j = 0; |
125 for (j = 0; j < histograms.size(); ++j) { | 125 for (j = 0; j < histograms.size(); ++j) { |
126 scoped_refptr<base::Histogram> histogram(histograms[j]); | 126 base::Histogram* histogram(histograms[j]); |
127 | 127 |
128 if (name == histogram->histogram_name()) { | 128 if (name == histogram->histogram_name()) { |
129 EXPECT_EQ(r.type, histogram->histogram_type()); | 129 EXPECT_EQ(r.type, histogram->histogram_type()); |
130 EXPECT_EQ(r.min, histogram->declared_min()); | 130 EXPECT_EQ(r.min, histogram->declared_min()); |
131 EXPECT_EQ(r.max, histogram->declared_max()); | 131 EXPECT_EQ(r.max, histogram->declared_max()); |
132 EXPECT_EQ(r.buckets, histogram->bucket_count()); | 132 EXPECT_EQ(r.buckets, histogram->bucket_count()); |
133 break; | 133 break; |
134 } | 134 } |
135 } | 135 } |
136 EXPECT_LT(j, histograms.size()); | 136 EXPECT_LT(j, histograms.size()); |
(...skipping 10 matching lines...) Expand all Loading... |
147 | 147 |
148 ASSERT_TRUE(RunExtensionTest("metrics")) << message_; | 148 ASSERT_TRUE(RunExtensionTest("metrics")) << message_; |
149 const Extension* extension = GetSingleLoadedExtension(); | 149 const Extension* extension = GetSingleLoadedExtension(); |
150 ASSERT_TRUE(extension); | 150 ASSERT_TRUE(extension); |
151 | 151 |
152 observer.ValidateUserActions(extension, | 152 observer.ValidateUserActions(extension, |
153 g_user_actions, | 153 g_user_actions, |
154 arraysize(g_user_actions)); | 154 arraysize(g_user_actions)); |
155 ValidateHistograms(extension, g_histograms, arraysize(g_histograms)); | 155 ValidateHistograms(extension, g_histograms, arraysize(g_histograms)); |
156 } | 156 } |
OLD | NEW |