holte | 6e36a3d | 2017-02-02 22:41:10 | [diff] [blame] | 1 | // 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 Holte | f9d5ed6 | 2017-10-21 02:02:30 | [diff] [blame] | 9 | #include "third_party/metrics_proto/reporting_info.pb.h" |
holte | 6e36a3d | 2017-02-02 22:41:10 | [diff] [blame] | 10 | |
| 11 | namespace metrics { |
| 12 | |
| 13 | class TestMetricsLogUploader : public MetricsLogUploader { |
| 14 | public: |
holte | 4ae63f5 | 2017-03-08 00:25:08 | [diff] [blame] | 15 | explicit TestMetricsLogUploader( |
holte | 035ec7fb | 2017-04-04 20:16:59 | [diff] [blame] | 16 | const MetricsLogUploader::UploadCallback& on_upload_complete); |
holte | 6e36a3d | 2017-02-02 22:41:10 | [diff] [blame] | 17 | ~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 Holte | 72428db | 2017-10-13 19:47:22 | [diff] [blame] | 25 | const ReportingInfo& reporting_info() const { return last_reporting_info_; } |
| 26 | |
holte | 6e36a3d | 2017-02-02 22:41:10 | [diff] [blame] | 27 | private: |
| 28 | // MetricsLogUploader: |
| 29 | void UploadLog(const std::string& compressed_log_data, |
Steven Holte | 72428db | 2017-10-13 19:47:22 | [diff] [blame] | 30 | const std::string& log_hash, |
| 31 | const ReportingInfo& reporting_info) override; |
holte | 6e36a3d | 2017-02-02 22:41:10 | [diff] [blame] | 32 | |
holte | 035ec7fb | 2017-04-04 20:16:59 | [diff] [blame] | 33 | const MetricsLogUploader::UploadCallback on_upload_complete_; |
Steven Holte | 72428db | 2017-10-13 19:47:22 | [diff] [blame] | 34 | ReportingInfo last_reporting_info_; |
holte | 6e36a3d | 2017-02-02 22:41:10 | [diff] [blame] | 35 | 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_ |