123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- // Copyright 2017 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_TEST_TEST_METRICS_LOG_UPLOADER_H_
- #define COMPONENTS_METRICS_TEST_TEST_METRICS_LOG_UPLOADER_H_
- #include "components/metrics/metrics_log_uploader.h"
- #include "third_party/metrics_proto/reporting_info.pb.h"
- namespace metrics {
- class TestMetricsLogUploader : public MetricsLogUploader {
- public:
- explicit TestMetricsLogUploader(
- const MetricsLogUploader::UploadCallback& on_upload_complete);
- TestMetricsLogUploader(const TestMetricsLogUploader&) = delete;
- TestMetricsLogUploader& operator=(const TestMetricsLogUploader&) = delete;
- ~TestMetricsLogUploader() override;
- // Mark the current upload complete with the given response code.
- void CompleteUpload(int response_code);
- // Check if UploadLog has been called.
- bool is_uploading() const { return is_uploading_; }
- const ReportingInfo& reporting_info() const { return last_reporting_info_; }
- private:
- // MetricsLogUploader:
- void UploadLog(const std::string& compressed_log_data,
- const std::string& log_hash,
- const std::string& log_signature,
- const ReportingInfo& reporting_info) override;
- const MetricsLogUploader::UploadCallback on_upload_complete_;
- ReportingInfo last_reporting_info_;
- bool is_uploading_;
- };
- } // namespace metrics
- #endif // COMPONENTS_METRICS_TEST_TEST_METRICS_LOG_UPLOADER_H_
|