xref: /aosp_15_r20/external/cronet/components/metrics/test/test_metrics_provider.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2015 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "components/metrics/test/test_metrics_provider.h"
6 
7 #include "base/metrics/histogram_macros.h"
8 
9 namespace metrics {
10 
Init()11 void TestMetricsProvider::Init() {
12   init_called_ = true;
13 }
14 
OnRecordingDisabled()15 void TestMetricsProvider::OnRecordingDisabled() {
16   on_recording_disabled_called_ = true;
17 }
18 
HasPreviousSessionData()19 bool TestMetricsProvider::HasPreviousSessionData() {
20   has_initial_stability_metrics_called_ = true;
21   return has_initial_stability_metrics_;
22 }
23 
ProvidePreviousSessionData(ChromeUserMetricsExtension * uma_proto)24 void TestMetricsProvider::ProvidePreviousSessionData(
25     ChromeUserMetricsExtension* uma_proto) {
26   UMA_STABILITY_HISTOGRAM_ENUMERATION("TestMetricsProvider.Initial", 1, 2);
27   provide_initial_stability_metrics_called_ = true;
28   ProvideCurrentSessionData(nullptr);
29 }
30 
ProvideCurrentSessionData(ChromeUserMetricsExtension * uma_proto)31 void TestMetricsProvider::ProvideCurrentSessionData(
32     ChromeUserMetricsExtension* uma_proto) {
33   UMA_STABILITY_HISTOGRAM_ENUMERATION("TestMetricsProvider.Regular", 1, 2);
34   provide_stability_metrics_called_ = true;
35 }
36 
ProvideSystemProfileMetrics(SystemProfileProto * system_profile_proto)37 void TestMetricsProvider::ProvideSystemProfileMetrics(
38     SystemProfileProto* system_profile_proto) {
39   provide_system_profile_metrics_called_ = true;
40 }
41 
RecordInitialHistogramSnapshots(base::HistogramSnapshotManager * snapshot_manager)42 void TestMetricsProvider::RecordInitialHistogramSnapshots(
43     base::HistogramSnapshotManager* snapshot_manager) {
44   record_initial_histogram_snapshots_called_ = true;
45 }
46 
RecordHistogramSnapshots(base::HistogramSnapshotManager * snapshot_manager)47 void TestMetricsProvider::RecordHistogramSnapshots(
48     base::HistogramSnapshotManager* snapshot_manager) {
49   record_histogram_snapshots_called_ = true;
50 }
51 
52 }  // namespace metrics
53