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

Side by Side Diff: chrome/browser/extensions/extension_metrics_apitest.cc

Issue 6780035: Use lock-free lazy initialization for static histogram references (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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 | Annotate | Revision Log
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/external_metrics.cc ('k') | chrome/browser/extensions/extension_metrics_module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698