blob: c8d724a458271bc5841a253f075a9c6208d17a87 [file] [log] [blame]
holte6e36a3d2017-02-02 22:41:101// Copyright 2017 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_LOG_UPLOADER_H_
6#define COMPONENTS_METRICS_TEST_METRICS_LOG_UPLOADER_H_
7
8#include "components/metrics/metrics_log_uploader.h"
Steven Holtef9d5ed62017-10-21 02:02:309#include "third_party/metrics_proto/reporting_info.pb.h"
holte6e36a3d2017-02-02 22:41:1010
11namespace metrics {
12
13class TestMetricsLogUploader : public MetricsLogUploader {
14 public:
holte4ae63f52017-03-08 00:25:0815 explicit TestMetricsLogUploader(
holte035ec7fb2017-04-04 20:16:5916 const MetricsLogUploader::UploadCallback& on_upload_complete);
holte6e36a3d2017-02-02 22:41:1017 ~TestMetricsLogUploader() override;
18
19 // Mark the current upload complete with the given response code.
20 void CompleteUpload(int response_code);
21
22 // Check if UploadLog has been called.
23 bool is_uploading() const { return is_uploading_; }
24
Steven Holte72428db2017-10-13 19:47:2225 const ReportingInfo& reporting_info() const { return last_reporting_info_; }
26
holte6e36a3d2017-02-02 22:41:1027 private:
28 // MetricsLogUploader:
29 void UploadLog(const std::string& compressed_log_data,
Steven Holte72428db2017-10-13 19:47:2230 const std::string& log_hash,
31 const ReportingInfo& reporting_info) override;
holte6e36a3d2017-02-02 22:41:1032
holte035ec7fb2017-04-04 20:16:5933 const MetricsLogUploader::UploadCallback on_upload_complete_;
Steven Holte72428db2017-10-13 19:47:2234 ReportingInfo last_reporting_info_;
holte6e36a3d2017-02-02 22:41:1035 bool is_uploading_;
36
37 DISALLOW_COPY_AND_ASSIGN(TestMetricsLogUploader);
38};
39
40} // namespace metrics
41
42#endif // COMPONENTS_METRICS_TEST_METRICS_LOG_UPLOADER_H_