[email protected] | 728de07 | 2014-05-21 09:20:32 | [diff] [blame] | 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. | ||||
4 | |||||
5 | #ifndef COMPONENTS_METRICS_TEST_METRICS_SERVICE_CLIENT_H_ | ||||
6 | #define COMPONENTS_METRICS_TEST_METRICS_SERVICE_CLIENT_H_ | ||||
7 | |||||
[email protected] | 4b4892b | 2014-05-22 15:06:15 | [diff] [blame] | 8 | #include <string> |
9 | |||||
[email protected] | 728de07 | 2014-05-21 09:20:32 | [diff] [blame] | 10 | #include "components/metrics/metrics_service_client.h" |
11 | |||||
12 | namespace metrics { | ||||
13 | |||||
14 | // A simple concrete implementation of the MetricsServiceClient interface, for | ||||
15 | // use in tests. | ||||
16 | class TestMetricsServiceClient : public MetricsServiceClient { | ||||
17 | public: | ||||
[email protected] | 09dee82d | 2014-05-22 14:00:53 | [diff] [blame] | 18 | static const char kBrandForTesting[]; |
19 | |||||
[email protected] | 728de07 | 2014-05-21 09:20:32 | [diff] [blame] | 20 | TestMetricsServiceClient(); |
dcheng | 00ea022b | 2014-10-21 11:24:56 | [diff] [blame^] | 21 | ~TestMetricsServiceClient() override; |
[email protected] | 728de07 | 2014-05-21 09:20:32 | [diff] [blame] | 22 | |
23 | // MetricsServiceClient: | ||||
dcheng | 00ea022b | 2014-10-21 11:24:56 | [diff] [blame^] | 24 | void SetMetricsClientId(const std::string& client_id) override; |
25 | bool IsOffTheRecordSessionActive() override; | ||||
26 | int32_t GetProduct() override; | ||||
27 | std::string GetApplicationLocale() override; | ||||
28 | bool GetBrand(std::string* brand_code) override; | ||||
29 | SystemProfileProto::Channel GetChannel() override; | ||||
30 | std::string GetVersionString() override; | ||||
31 | void OnLogUploadComplete() override; | ||||
32 | void StartGatheringMetrics(const base::Closure& done_callback) override; | ||||
33 | void CollectFinalMetrics(const base::Closure& done_callback) override; | ||||
34 | scoped_ptr<MetricsLogUploader> CreateUploader( | ||||
[email protected] | 0d5a61a8 | 2014-05-31 22:28:34 | [diff] [blame] | 35 | const std::string& server_url, |
36 | const std::string& mime_type, | ||||
mostynb | fe59f48 | 2014-10-06 15:04:46 | [diff] [blame] | 37 | const base::Callback<void(int)>& on_upload_complete) override; |
[email protected] | 728de07 | 2014-05-21 09:20:32 | [diff] [blame] | 38 | |
39 | const std::string& get_client_id() const { return client_id_; } | ||||
[email protected] | bfb77b5 | 2014-06-07 01:54:01 | [diff] [blame] | 40 | void set_version_string(const std::string& str) { version_string_ = str; } |
asvitkine | 4c1d1ef | 2014-09-29 20:57:32 | [diff] [blame] | 41 | void set_product(int32_t product) { product_ = product; } |
[email protected] | 728de07 | 2014-05-21 09:20:32 | [diff] [blame] | 42 | |
43 | private: | ||||
44 | std::string client_id_; | ||||
[email protected] | bfb77b5 | 2014-06-07 01:54:01 | [diff] [blame] | 45 | std::string version_string_; |
asvitkine | 4c1d1ef | 2014-09-29 20:57:32 | [diff] [blame] | 46 | int32_t product_; |
[email protected] | bfb77b5 | 2014-06-07 01:54:01 | [diff] [blame] | 47 | |
48 | DISALLOW_COPY_AND_ASSIGN(TestMetricsServiceClient); | ||||
[email protected] | 728de07 | 2014-05-21 09:20:32 | [diff] [blame] | 49 | }; |
50 | |||||
51 | } // namespace metrics | ||||
52 | |||||
53 | #endif // COMPONENTS_METRICS_TEST_METRICS_SERVICE_CLIENT_H_ |