| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "components/metrics/metrics_service_client.h" | 10 #include "components/metrics/metrics_service_client.h" |
| 11 | 11 |
| 12 namespace metrics { | 12 namespace metrics { |
| 13 | 13 |
| 14 // A simple concrete implementation of the MetricsServiceClient interface, for | 14 // A simple concrete implementation of the MetricsServiceClient interface, for |
| 15 // use in tests. | 15 // use in tests. |
| 16 class TestMetricsServiceClient : public MetricsServiceClient { | 16 class TestMetricsServiceClient : public MetricsServiceClient { |
| 17 public: | 17 public: |
| 18 static const char kBrandForTesting[]; | 18 static const char kBrandForTesting[]; |
| 19 | 19 |
| 20 TestMetricsServiceClient(); | 20 TestMetricsServiceClient(); |
| 21 virtual ~TestMetricsServiceClient(); | 21 virtual ~TestMetricsServiceClient(); |
| 22 | 22 |
| 23 // MetricsServiceClient: | 23 // MetricsServiceClient: |
| 24 virtual void SetClientID(const std::string& client_id) OVERRIDE; | 24 virtual void SetClientID(const std::string& client_id) OVERRIDE; |
| 25 virtual bool IsOffTheRecordSessionActive() OVERRIDE; | 25 virtual bool IsOffTheRecordSessionActive() OVERRIDE; |
| 26 virtual std::string GetApplicationLocale() OVERRIDE; | 26 virtual std::string GetApplicationLocale() OVERRIDE; |
| 27 virtual bool GetBrand(std::string* brand_code) OVERRIDE; | 27 virtual bool GetBrand(std::string* brand_code) OVERRIDE; |
| 28 virtual SystemProfileProto::Channel GetChannel() OVERRIDE; | 28 virtual SystemProfileProto::Channel GetChannel() OVERRIDE; |
| 29 virtual std::string GetVersionString() OVERRIDE; | 29 virtual std::string GetVersionString() OVERRIDE; |
| 30 virtual int64 GetInstallDate() OVERRIDE; | |
| 31 virtual void OnLogUploadComplete() OVERRIDE; | 30 virtual void OnLogUploadComplete() OVERRIDE; |
| 32 virtual void StartGatheringMetrics( | 31 virtual void StartGatheringMetrics( |
| 33 const base::Closure& done_callback) OVERRIDE; | 32 const base::Closure& done_callback) OVERRIDE; |
| 34 virtual void CollectFinalMetrics(const base::Closure& done_callback) | 33 virtual void CollectFinalMetrics(const base::Closure& done_callback) |
| 35 OVERRIDE; | 34 OVERRIDE; |
| 36 virtual scoped_ptr<MetricsLogUploader> CreateUploader( | 35 virtual scoped_ptr<MetricsLogUploader> CreateUploader( |
| 37 const std::string& server_url, | 36 const std::string& server_url, |
| 38 const std::string& mime_type, | 37 const std::string& mime_type, |
| 39 const base::Callback<void(int)>& on_upload_complete) OVERRIDE; | 38 const base::Callback<void(int)>& on_upload_complete) OVERRIDE; |
| 40 | 39 |
| 41 const std::string& get_client_id() const { return client_id_; } | 40 const std::string& get_client_id() const { return client_id_; } |
| 42 void set_install_date(int64 install_date) { install_date_ = install_date; } | |
| 43 void set_version_string(const std::string& str) { version_string_ = str; } | 41 void set_version_string(const std::string& str) { version_string_ = str; } |
| 44 | 42 |
| 45 private: | 43 private: |
| 46 std::string client_id_; | 44 std::string client_id_; |
| 47 int64 install_date_; | |
| 48 std::string version_string_; | 45 std::string version_string_; |
| 49 | 46 |
| 50 DISALLOW_COPY_AND_ASSIGN(TestMetricsServiceClient); | 47 DISALLOW_COPY_AND_ASSIGN(TestMetricsServiceClient); |
| 51 }; | 48 }; |
| 52 | 49 |
| 53 } // namespace metrics | 50 } // namespace metrics |
| 54 | 51 |
| 55 #endif // COMPONENTS_METRICS_TEST_METRICS_SERVICE_CLIENT_H_ | 52 #endif // COMPONENTS_METRICS_TEST_METRICS_SERVICE_CLIENT_H_ |
| OLD | NEW |