1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_METRICS_TEST_METRICS_PROVIDER_H_
6 #define COMPONENTS_METRICS_TEST_METRICS_PROVIDER_H_
8 #include "base/macros.h"
9 #include "components/metrics/metrics_provider.h"
13 // A simple implementation of MetricsProvider that checks that its providing
14 // functions are called, for use in tests.
15 class TestMetricsProvider
: public MetricsProvider
{
18 : on_recording_disabled_called_(false),
19 has_initial_stability_metrics_(false),
20 provide_initial_stability_metrics_called_(false),
21 provide_stability_metrics_called_(false) {}
24 void OnRecordingDisabled() override
;
25 bool HasInitialStabilityMetrics() override
;
26 void ProvideInitialStabilityMetrics(
27 SystemProfileProto
* system_profile_proto
) override
;
28 void ProvideStabilityMetrics(
29 SystemProfileProto
* system_profile_proto
) override
;
31 bool on_recording_disabled_called() { return on_recording_disabled_called_
; }
32 void set_has_initial_stability_metrics(bool has_initial_stability_metrics
) {
33 has_initial_stability_metrics_
= has_initial_stability_metrics
;
35 bool provide_initial_stability_metrics_called() const {
36 return provide_initial_stability_metrics_called_
;
38 bool provide_stability_metrics_called() const {
39 return provide_stability_metrics_called_
;
43 bool on_recording_disabled_called_
;
44 bool has_initial_stability_metrics_
;
45 bool provide_initial_stability_metrics_called_
;
46 bool provide_stability_metrics_called_
;
48 DISALLOW_COPY_AND_ASSIGN(TestMetricsProvider
);
51 } // namespace metrics
53 #endif // COMPONENTS_METRICS_TEST_METRICS_PROVIDER_H_