Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Unified Diff: components/metrics/mock_metrics_service_client.h

Issue 866163002: Allow use of metrics url override outside of Chromecast (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/metrics/metrics_switches.cc ('k') | components/metrics/mock_metrics_service_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/metrics/mock_metrics_service_client.h
diff --git a/components/metrics/mock_metrics_service_client.h b/components/metrics/mock_metrics_service_client.h
new file mode 100644
index 0000000000000000000000000000000000000000..fa415a9d03a0aa6a6d39c76c692beaaec52e8734
--- /dev/null
+++ b/components/metrics/mock_metrics_service_client.h
@@ -0,0 +1,68 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_METRICS_MOCK_METRICS_SERVICE_CLIENT_H_
+#define COMPONENTS_METRICS_MOCK_METRICS_SERVICE_CLIENT_H_
+
+#include <string>
+
+#include "base/callback.h"
+
+#include "components/metrics/metrics_log_uploader.h"
+#include "components/metrics/metrics_service_client.h"
+#include "testing/gmock/include/gmock/gmock.h"
+
+namespace metrics {
+
+class MockMetricsServiceClient : public MetricsServiceClient {
+ public:
+ MockMetricsServiceClient();
+ virtual ~MockMetricsServiceClient();
+
+ // GMock doesn't support the return type of scoped_ptr<> because
+ // scoped_ptr is uncopyable. This is a workaround which defines
+ // |MockCreateUploader| as a mock method and makes |CreateUploader|
+ // call the mocked method.
+ // Use |MockCreateUploader| for setting/testing expectations.
+ MOCK_METHOD3(MockCreateUploader,
+ MetricsLogUploader*(
+ const std::string& server_url,
+ const std::string& mime_type,
+ const base::Callback<void(int)>& on_upload_complete));
+ virtual scoped_ptr<MetricsLogUploader> CreateUploader(
+ const std::string& server_url,
+ const std::string& mime_type,
+ const base::Callback<void(int)>& on_upload_complete);
+ MOCK_METHOD1(SetMetricsClientId,
+ void(const std::string& client_id));
+ MOCK_METHOD0(IsOffTheRecordSessionActive,
+ bool());
+ MOCK_METHOD0(GetProduct,
+ int32_t());
+ MOCK_METHOD0(GetApplicationLocale,
+ std::string());
+ MOCK_METHOD1(GetBrand,
+ bool(std::string* brand_code));
+ MOCK_METHOD0(GetChannel,
+ SystemProfileProto::Channel());
+ MOCK_METHOD0(GetVersionString,
+ std::string());
+ MOCK_METHOD0(OnLogUploadComplete,
+ void());
+ MOCK_METHOD1(StartGatheringMetrics,
+ void(const base::Closure& done_callback));
+ MOCK_METHOD1(CollectFinalMetrics,
+ void(const base::Closure& done_callback));
+ MOCK_METHOD0(GetRegistryBackupKey,
+ base::string16());
+
+ void DoNothing(int x);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(MockMetricsServiceClient);
+};
+
+} // namespace metrics
+
+#endif // COMPONENTS_METRICS_MOCK_METRICS_SERVICE_CLIENT_H_
« no previous file with comments | « components/metrics/metrics_switches.cc ('k') | components/metrics/mock_metrics_service_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698