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

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

Issue 1476633003: Move HashMetricName to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed unittest Created 5 years 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/metrics_service.h" 5 #include "components/metrics/metrics_service.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/metrics/metrics_hashes.h"
12 #include "base/metrics/statistics_recorder.h" 13 #include "base/metrics/statistics_recorder.h"
13 #include "base/prefs/testing_pref_service.h" 14 #include "base/prefs/testing_pref_service.h"
14 #include "base/threading/platform_thread.h" 15 #include "base/threading/platform_thread.h"
15 #include "components/compression/compression_utils.h" 16 #include "components/compression/compression_utils.h"
16 #include "components/metrics/client_info.h" 17 #include "components/metrics/client_info.h"
17 #include "components/metrics/metrics_hashes.h"
18 #include "components/metrics/metrics_log.h" 18 #include "components/metrics/metrics_log.h"
19 #include "components/metrics/metrics_pref_names.h" 19 #include "components/metrics/metrics_pref_names.h"
20 #include "components/metrics/metrics_state_manager.h" 20 #include "components/metrics/metrics_state_manager.h"
21 #include "components/metrics/test_metrics_provider.h" 21 #include "components/metrics/test_metrics_provider.h"
22 #include "components/metrics/test_metrics_service_client.h" 22 #include "components/metrics/test_metrics_service_client.h"
23 #include "components/variations/metrics_util.h" 23 #include "components/variations/metrics_util.h"
24 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
25 25
26 namespace metrics { 26 namespace metrics {
27 27
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 return true; 115 return true;
116 } 116 }
117 return false; 117 return false;
118 } 118 }
119 119
120 // Finds a histogram with the specified |name_hash| in |histograms|. 120 // Finds a histogram with the specified |name_hash| in |histograms|.
121 const base::HistogramBase* FindHistogram( 121 const base::HistogramBase* FindHistogram(
122 const base::StatisticsRecorder::Histograms& histograms, 122 const base::StatisticsRecorder::Histograms& histograms,
123 uint64 name_hash) { 123 uint64 name_hash) {
124 for (const base::HistogramBase* histogram : histograms) { 124 for (const base::HistogramBase* histogram : histograms) {
125 if (name_hash == HashMetricName(histogram->histogram_name())) 125 if (name_hash == base::HashMetricName(histogram->histogram_name()))
126 return histogram; 126 return histogram;
127 } 127 }
128 return nullptr; 128 return nullptr;
129 } 129 }
130 130
131 // Checks whether |uma_log| contains any histograms that are not flagged 131 // Checks whether |uma_log| contains any histograms that are not flagged
132 // with kUmaStabilityHistogramFlag. Stability logs should only contain such 132 // with kUmaStabilityHistogramFlag. Stability logs should only contain such
133 // histograms. 133 // histograms.
134 void CheckForNonStabilityHistograms( 134 void CheckForNonStabilityHistograms(
135 const ChromeUserMetricsExtension& uma_log) { 135 const ChromeUserMetricsExtension& uma_log) {
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 TestMetricsProvider* test_provider = new TestMetricsProvider(); 384 TestMetricsProvider* test_provider = new TestMetricsProvider();
385 service.RegisterMetricsProvider(scoped_ptr<MetricsProvider>(test_provider)); 385 service.RegisterMetricsProvider(scoped_ptr<MetricsProvider>(test_provider));
386 386
387 service.InitializeMetricsRecordingState(); 387 service.InitializeMetricsRecordingState();
388 service.Stop(); 388 service.Stop();
389 389
390 EXPECT_TRUE(test_provider->on_recording_disabled_called()); 390 EXPECT_TRUE(test_provider->on_recording_disabled_called());
391 } 391 }
392 392
393 } // namespace metrics 393 } // namespace metrics
OLDNEW
« no previous file with comments | « components/metrics/metrics_log.cc ('k') | components/metrics/profiler/profiler_metrics_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698