OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_METRICS_TEST_METRICS_SERVICE_CLIENT_H_ | 5 #ifndef COMPONENTS_METRICS_TEST_METRICS_SERVICE_CLIENT_H_ |
6 #define COMPONENTS_METRICS_TEST_METRICS_SERVICE_CLIENT_H_ | 6 #define COMPONENTS_METRICS_TEST_METRICS_SERVICE_CLIENT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "components/metrics/metrics_service_client.h" | 13 #include "components/metrics/metrics_service_client.h" |
14 | 14 |
15 namespace metrics { | 15 namespace metrics { |
16 | 16 |
17 // A simple concrete implementation of the MetricsServiceClient interface, for | 17 // A simple concrete implementation of the MetricsServiceClient interface, for |
18 // use in tests. | 18 // use in tests. |
19 class TestMetricsServiceClient : public MetricsServiceClient { | 19 class TestMetricsServiceClient : public MetricsServiceClient { |
20 public: | 20 public: |
21 static const char kBrandForTesting[]; | 21 static const char kBrandForTesting[]; |
22 | 22 |
23 TestMetricsServiceClient(); | 23 TestMetricsServiceClient(); |
24 ~TestMetricsServiceClient() override; | 24 ~TestMetricsServiceClient() override; |
25 | 25 |
26 // MetricsServiceClient: | 26 // MetricsServiceClient: |
27 metrics::MetricsService* GetMetricsService() override; | 27 metrics::MetricsService* GetMetricsService() override; |
| 28 ukm::UkmService* GetUkmService() override; |
28 void SetMetricsClientId(const std::string& client_id) override; | 29 void SetMetricsClientId(const std::string& client_id) override; |
29 int32_t GetProduct() override; | 30 int32_t GetProduct() override; |
30 std::string GetApplicationLocale() override; | 31 std::string GetApplicationLocale() override; |
31 bool GetBrand(std::string* brand_code) override; | 32 bool GetBrand(std::string* brand_code) override; |
32 SystemProfileProto::Channel GetChannel() override; | 33 SystemProfileProto::Channel GetChannel() override; |
33 std::string GetVersionString() override; | 34 std::string GetVersionString() override; |
34 void OnLogUploadComplete() override; | 35 void OnLogUploadComplete() override; |
35 void InitializeSystemProfileMetrics( | 36 void InitializeSystemProfileMetrics( |
36 const base::Closure& done_callback) override; | 37 const base::Closure& done_callback) override; |
37 void CollectFinalMetricsForLog(const base::Closure& done_callback) override; | 38 void CollectFinalMetricsForLog(const base::Closure& done_callback) override; |
38 std::unique_ptr<MetricsLogUploader> CreateUploader( | 39 std::unique_ptr<MetricsLogUploader> CreateUploader( |
| 40 const std::string& server_url, |
| 41 const std::string& mime_type, |
39 const base::Callback<void(int)>& on_upload_complete) override; | 42 const base::Callback<void(int)>& on_upload_complete) override; |
40 base::TimeDelta GetStandardUploadInterval() override; | 43 base::TimeDelta GetStandardUploadInterval() override; |
41 bool IsReportingPolicyManaged() override; | 44 bool IsReportingPolicyManaged() override; |
42 EnableMetricsDefault GetMetricsReportingDefaultState() override; | 45 EnableMetricsDefault GetMetricsReportingDefaultState() override; |
43 | 46 |
44 const std::string& get_client_id() const { return client_id_; } | 47 const std::string& get_client_id() const { return client_id_; } |
45 void set_version_string(const std::string& str) { version_string_ = str; } | 48 void set_version_string(const std::string& str) { version_string_ = str; } |
46 void set_product(int32_t product) { product_ = product; } | 49 void set_product(int32_t product) { product_ = product; } |
47 void set_reporting_is_managed(bool managed) { | 50 void set_reporting_is_managed(bool managed) { |
48 reporting_is_managed_ = managed; | 51 reporting_is_managed_ = managed; |
49 } | 52 } |
50 void set_enable_default(EnableMetricsDefault enable_default) { | 53 void set_enable_default(EnableMetricsDefault enable_default) { |
51 enable_default_ = enable_default; | 54 enable_default_ = enable_default; |
52 } | 55 } |
53 | 56 |
54 private: | 57 private: |
55 std::string client_id_; | 58 std::string client_id_; |
56 std::string version_string_; | 59 std::string version_string_; |
57 int32_t product_; | 60 int32_t product_; |
58 bool reporting_is_managed_; | 61 bool reporting_is_managed_; |
59 EnableMetricsDefault enable_default_; | 62 EnableMetricsDefault enable_default_; |
60 | 63 |
61 DISALLOW_COPY_AND_ASSIGN(TestMetricsServiceClient); | 64 DISALLOW_COPY_AND_ASSIGN(TestMetricsServiceClient); |
62 }; | 65 }; |
63 | 66 |
64 } // namespace metrics | 67 } // namespace metrics |
65 | 68 |
66 #endif // COMPONENTS_METRICS_TEST_METRICS_SERVICE_CLIENT_H_ | 69 #endif // COMPONENTS_METRICS_TEST_METRICS_SERVICE_CLIENT_H_ |
OLD | NEW |