Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / components / metrics / test_metrics_service_client.h
blob5ea09a8c1797218099f089c4f3d22c5ce2d5a6e6
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_METRICS_TEST_METRICS_SERVICE_CLIENT_H_
6 #define COMPONENTS_METRICS_TEST_METRICS_SERVICE_CLIENT_H_
8 #include <string>
10 #include "components/metrics/metrics_service_client.h"
12 namespace metrics {
14 // A simple concrete implementation of the MetricsServiceClient interface, for
15 // use in tests.
16 class TestMetricsServiceClient : public MetricsServiceClient {
17 public:
18 static const char kBrandForTesting[];
20 TestMetricsServiceClient();
21 ~TestMetricsServiceClient() override;
23 // MetricsServiceClient:
24 void SetMetricsClientId(const std::string& client_id) override;
25 void OnRecordingDisabled() override;
26 bool IsOffTheRecordSessionActive() override;
27 int32_t GetProduct() override;
28 std::string GetApplicationLocale() override;
29 bool GetBrand(std::string* brand_code) override;
30 SystemProfileProto::Channel GetChannel() override;
31 std::string GetVersionString() override;
32 void OnLogUploadComplete() override;
33 void InitializeSystemProfileMetrics(
34 const base::Closure& done_callback) override;
35 void CollectFinalMetricsForLog(const base::Closure& done_callback) override;
36 scoped_ptr<MetricsLogUploader> CreateUploader(
37 const base::Callback<void(int)>& on_upload_complete) override;
38 base::TimeDelta GetStandardUploadInterval() override;
40 const std::string& get_client_id() const { return client_id_; }
41 void set_version_string(const std::string& str) { version_string_ = str; }
42 void set_product(int32_t product) { product_ = product; }
44 private:
45 std::string client_id_;
46 std::string version_string_;
47 int32_t product_;
49 DISALLOW_COPY_AND_ASSIGN(TestMetricsServiceClient);
52 } // namespace metrics
54 #endif // COMPONENTS_METRICS_TEST_METRICS_SERVICE_CLIENT_H_