| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/metrics/test_metrics_log_uploader.h" | 5 #include "components/metrics/test_metrics_log_uploader.h" |
| 6 #include "components/metrics/metrics_log_uploader.h" | 6 #include "components/metrics/metrics_log_uploader.h" |
| 7 | 7 |
| 8 namespace metrics { | 8 namespace metrics { |
| 9 | 9 |
| 10 TestMetricsLogUploader::TestMetricsLogUploader( | 10 TestMetricsLogUploader::TestMetricsLogUploader( |
| 11 const std::string& server_url, | |
| 12 const std::string& mime_type, | |
| 13 MetricsLogUploader::MetricServiceType service_type, | |
| 14 const base::Callback<void(int)>& on_upload_complete) | 11 const base::Callback<void(int)>& on_upload_complete) |
| 15 : MetricsLogUploader(server_url, | 12 : on_upload_complete_(on_upload_complete), is_uploading_(false) {} |
| 16 mime_type, | |
| 17 service_type, | |
| 18 on_upload_complete), | |
| 19 is_uploading_(false) {} | |
| 20 | 13 |
| 21 TestMetricsLogUploader::~TestMetricsLogUploader() = default; | 14 TestMetricsLogUploader::~TestMetricsLogUploader() = default; |
| 22 | 15 |
| 23 void TestMetricsLogUploader::CompleteUpload(int response_code) { | 16 void TestMetricsLogUploader::CompleteUpload(int response_code) { |
| 24 DCHECK(is_uploading_); | 17 DCHECK(is_uploading_); |
| 25 is_uploading_ = false; | 18 is_uploading_ = false; |
| 26 on_upload_complete_.Run(response_code); | 19 on_upload_complete_.Run(response_code); |
| 27 } | 20 } |
| 28 | 21 |
| 29 void TestMetricsLogUploader::UploadLog(const std::string& compressed_log_data, | 22 void TestMetricsLogUploader::UploadLog(const std::string& compressed_log_data, |
| 30 const std::string& log_hash) { | 23 const std::string& log_hash) { |
| 31 DCHECK(!is_uploading_); | 24 DCHECK(!is_uploading_); |
| 32 is_uploading_ = true; | 25 is_uploading_ = true; |
| 33 } | 26 } |
| 34 | 27 |
| 35 } // namespace metrics | 28 } // namespace metrics |
| OLD | NEW |