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 : has_initial_stability_metrics_(false),
19 provide_initial_stability_metrics_called_(false),
20 provide_stability_metrics_called_(false) {}
23 bool HasInitialStabilityMetrics() override
;
24 void ProvideInitialStabilityMetrics(
25 SystemProfileProto
* system_profile_proto
) override
;
26 void ProvideStabilityMetrics(
27 SystemProfileProto
* system_profile_proto
) override
;
29 void set_has_initial_stability_metrics(bool has_initial_stability_metrics
) {
30 has_initial_stability_metrics_
= has_initial_stability_metrics
;
32 bool provide_initial_stability_metrics_called() const {
33 return provide_initial_stability_metrics_called_
;
35 bool provide_stability_metrics_called() const {
36 return provide_stability_metrics_called_
;
40 bool has_initial_stability_metrics_
;
41 bool provide_initial_stability_metrics_called_
;
42 bool provide_stability_metrics_called_
;
44 DISALLOW_COPY_AND_ASSIGN(TestMetricsProvider
);
47 } // namespace metrics
49 #endif // COMPONENTS_METRICS_TEST_METRICS_PROVIDER_H_