blob: 52f1889a5be8198a986f1f2020e73467677ce2b2 [file] [log] [blame]
[email protected]728de072014-05-21 09:20:321// 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.
4
5#ifndef COMPONENTS_METRICS_TEST_METRICS_SERVICE_CLIENT_H_
6#define COMPONENTS_METRICS_TEST_METRICS_SERVICE_CLIENT_H_
7
[email protected]4b4892b2014-05-22 15:06:158#include <string>
9
[email protected]728de072014-05-21 09:20:3210#include "components/metrics/metrics_service_client.h"
11
12namespace metrics {
13
14// A simple concrete implementation of the MetricsServiceClient interface, for
15// use in tests.
16class TestMetricsServiceClient : public MetricsServiceClient {
17 public:
[email protected]09dee82d2014-05-22 14:00:5318 static const char kBrandForTesting[];
19
[email protected]728de072014-05-21 09:20:3220 TestMetricsServiceClient();
dcheng00ea022b2014-10-21 11:24:5621 ~TestMetricsServiceClient() override;
[email protected]728de072014-05-21 09:20:3222
23 // MetricsServiceClient:
dcheng00ea022b2014-10-21 11:24:5624 void SetMetricsClientId(const std::string& client_id) override;
Mark Mentovaic67fa64f2015-03-24 14:00:0625 void OnRecordingDisabled() override;
dcheng00ea022b2014-10-21 11:24:5626 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 StartGatheringMetrics(const base::Closure& done_callback) override;
34 void CollectFinalMetrics(const base::Closure& done_callback) override;
35 scoped_ptr<MetricsLogUploader> CreateUploader(
mostynbfe59f482014-10-06 15:04:4636 const base::Callback<void(int)>& on_upload_complete) override;
gunsch7cbdcb22015-03-13 17:02:0537 base::TimeDelta GetStandardUploadInterval() override;
[email protected]728de072014-05-21 09:20:3238
39 const std::string& get_client_id() const { return client_id_; }
[email protected]bfb77b52014-06-07 01:54:0140 void set_version_string(const std::string& str) { version_string_ = str; }
asvitkine4c1d1ef2014-09-29 20:57:3241 void set_product(int32_t product) { product_ = product; }
[email protected]728de072014-05-21 09:20:3242
43 private:
44 std::string client_id_;
[email protected]bfb77b52014-06-07 01:54:0145 std::string version_string_;
asvitkine4c1d1ef2014-09-29 20:57:3246 int32_t product_;
[email protected]bfb77b52014-06-07 01:54:0147
48 DISALLOW_COPY_AND_ASSIGN(TestMetricsServiceClient);
[email protected]728de072014-05-21 09:20:3249};
50
51} // namespace metrics
52
53#endif // COMPONENTS_METRICS_TEST_METRICS_SERVICE_CLIENT_H_