• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 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 #ifndef COMPONENTS_METRICS_TEST_TEST_ENABLED_STATE_PROVIDER_H_
6 #define COMPONENTS_METRICS_TEST_TEST_ENABLED_STATE_PROVIDER_H_
7 
8 #include "components/metrics/enabled_state_provider.h"
9 
10 namespace metrics {
11 
12 // A simple concrete implementation of the EnabledStateProvider interface, for
13 // use in tests.
14 class TestEnabledStateProvider : public EnabledStateProvider {
15  public:
TestEnabledStateProvider(bool consent,bool enabled)16   TestEnabledStateProvider(bool consent, bool enabled)
17       : consent_(consent), enabled_(enabled) {}
18 
19   TestEnabledStateProvider(const TestEnabledStateProvider&) = delete;
20   TestEnabledStateProvider& operator=(const TestEnabledStateProvider&) = delete;
21 
~TestEnabledStateProvider()22   ~TestEnabledStateProvider() override {}
23 
24   // EnabledStateProvider
25   bool IsConsentGiven() const override;
26   bool IsReportingEnabled() const override;
27 
set_consent(bool consent)28   void set_consent(bool consent) { consent_ = consent; }
set_enabled(bool enabled)29   void set_enabled(bool enabled) { enabled_ = enabled; }
30 
31  private:
32   bool consent_;
33   bool enabled_;
34 };
35 
36 }  // namespace metrics
37 
38 #endif  // COMPONENTS_METRICS_TEST_TEST_ENABLED_STATE_PROVIDER_H_
39