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_log_uploader.h" |
13 #include "components/metrics/metrics_service_client.h" | 14 #include "components/metrics/metrics_service_client.h" |
14 #include "components/metrics/test_metrics_log_uploader.h" | 15 #include "components/metrics/test_metrics_log_uploader.h" |
15 | 16 |
16 namespace metrics { | 17 namespace metrics { |
17 | 18 |
18 // A simple concrete implementation of the MetricsServiceClient interface, for | 19 // A simple concrete implementation of the MetricsServiceClient interface, for |
19 // use in tests. | 20 // use in tests. |
20 class TestMetricsServiceClient : public MetricsServiceClient { | 21 class TestMetricsServiceClient : public MetricsServiceClient { |
21 public: | 22 public: |
22 static const char kBrandForTesting[]; | 23 static const char kBrandForTesting[]; |
23 | 24 |
24 TestMetricsServiceClient(); | 25 TestMetricsServiceClient(); |
25 ~TestMetricsServiceClient() override; | 26 ~TestMetricsServiceClient() override; |
26 | 27 |
27 // MetricsServiceClient: | 28 // MetricsServiceClient: |
28 metrics::MetricsService* GetMetricsService() override; | 29 metrics::MetricsService* GetMetricsService() override; |
29 void SetMetricsClientId(const std::string& client_id) override; | 30 void SetMetricsClientId(const std::string& client_id) override; |
30 int32_t GetProduct() override; | 31 int32_t GetProduct() override; |
31 std::string GetApplicationLocale() override; | 32 std::string GetApplicationLocale() override; |
32 bool GetBrand(std::string* brand_code) override; | 33 bool GetBrand(std::string* brand_code) override; |
33 SystemProfileProto::Channel GetChannel() override; | 34 SystemProfileProto::Channel GetChannel() override; |
34 std::string GetVersionString() override; | 35 std::string GetVersionString() 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( |
39 const std::string& server_url, | 40 const std::string& server_url, |
40 const std::string& mime_type, | 41 const std::string& mime_type, |
| 42 MetricsLogUploader::MetricServiceType service_type, |
41 const base::Callback<void(int)>& on_upload_complete) override; | 43 const base::Callback<void(int)>& on_upload_complete) override; |
42 base::TimeDelta GetStandardUploadInterval() override; | 44 base::TimeDelta GetStandardUploadInterval() override; |
43 bool IsReportingPolicyManaged() override; | 45 bool IsReportingPolicyManaged() override; |
44 EnableMetricsDefault GetMetricsReportingDefaultState() override; | 46 EnableMetricsDefault GetMetricsReportingDefaultState() override; |
45 | 47 |
46 const std::string& get_client_id() const { return client_id_; } | 48 const std::string& get_client_id() const { return client_id_; } |
47 // Returns a weak ref to the last created uploader. | 49 // Returns a weak ref to the last created uploader. |
48 TestMetricsLogUploader* uploader() { return uploader_; } | 50 TestMetricsLogUploader* uploader() { return uploader_; } |
49 void set_version_string(const std::string& str) { version_string_ = str; } | 51 void set_version_string(const std::string& str) { version_string_ = str; } |
50 void set_product(int32_t product) { product_ = product; } | 52 void set_product(int32_t product) { product_ = product; } |
(...skipping 13 matching lines...) Expand all Loading... |
64 | 66 |
65 // A weak ref to the last created TestMetricsLogUploader. | 67 // A weak ref to the last created TestMetricsLogUploader. |
66 TestMetricsLogUploader* uploader_; | 68 TestMetricsLogUploader* uploader_; |
67 | 69 |
68 DISALLOW_COPY_AND_ASSIGN(TestMetricsServiceClient); | 70 DISALLOW_COPY_AND_ASSIGN(TestMetricsServiceClient); |
69 }; | 71 }; |
70 | 72 |
71 } // namespace metrics | 73 } // namespace metrics |
72 | 74 |
73 #endif // COMPONENTS_METRICS_TEST_METRICS_SERVICE_CLIENT_H_ | 75 #endif // COMPONENTS_METRICS_TEST_METRICS_SERVICE_CLIENT_H_ |
OLD | NEW |