1cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
2cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// found in the LICENSE file.
4cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
5cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#ifndef COMPONENTS_METRICS_TEST_METRICS_SERVICE_CLIENT_H_
6cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#define COMPONENTS_METRICS_TEST_METRICS_SERVICE_CLIENT_H_
7cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
8cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include <string>
9cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
10cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "components/metrics/metrics_service_client.h"
11cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
12cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)namespace metrics {
13cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
14cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// A simple concrete implementation of the MetricsServiceClient interface, for
15cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// use in tests.
16cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class TestMetricsServiceClient : public MetricsServiceClient {
17cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) public:
18cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  static const char kBrandForTesting[];
19cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
20cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  TestMetricsServiceClient();
21cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  virtual ~TestMetricsServiceClient();
22cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
23cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // MetricsServiceClient:
24116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  virtual void SetMetricsClientId(const std::string& client_id) OVERRIDE;
25cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  virtual bool IsOffTheRecordSessionActive() OVERRIDE;
26cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  virtual std::string GetApplicationLocale() OVERRIDE;
27cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  virtual bool GetBrand(std::string* brand_code) OVERRIDE;
28cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  virtual SystemProfileProto::Channel GetChannel() OVERRIDE;
29cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  virtual std::string GetVersionString() OVERRIDE;
30cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  virtual void OnLogUploadComplete() OVERRIDE;
31cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  virtual void StartGatheringMetrics(
32cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      const base::Closure& done_callback) OVERRIDE;
33cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  virtual void CollectFinalMetrics(const base::Closure& done_callback)
34cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      OVERRIDE;
3546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  virtual scoped_ptr<MetricsLogUploader> CreateUploader(
3646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      const std::string& server_url,
3746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      const std::string& mime_type,
3846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      const base::Callback<void(int)>& on_upload_complete) OVERRIDE;
39cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
40cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  const std::string& get_client_id() const { return client_id_; }
4146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  void set_version_string(const std::string& str) { version_string_ = str; }
42cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
43cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) private:
44cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  std::string client_id_;
4546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  std::string version_string_;
4646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
4746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(TestMetricsServiceClient);
48cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)};
49cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
50cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)}  // namespace metrics
51cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
52cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#endif  // COMPONENTS_METRICS_TEST_METRICS_SERVICE_CLIENT_H_
53