test_metrics_log_uploader.cc 1.1 KB

1234567891011121314151617181920212223242526272829303132
  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. #include "components/metrics/test/test_metrics_log_uploader.h"
  5. #include "components/metrics/metrics_log_uploader.h"
  6. namespace metrics {
  7. TestMetricsLogUploader::TestMetricsLogUploader(
  8. const MetricsLogUploader::UploadCallback& on_upload_complete)
  9. : on_upload_complete_(on_upload_complete), is_uploading_(false) {}
  10. TestMetricsLogUploader::~TestMetricsLogUploader() = default;
  11. void TestMetricsLogUploader::CompleteUpload(int response_code) {
  12. DCHECK(is_uploading_);
  13. is_uploading_ = false;
  14. last_reporting_info_.Clear();
  15. on_upload_complete_.Run(response_code, 0, false);
  16. }
  17. void TestMetricsLogUploader::UploadLog(const std::string& compressed_log_data,
  18. const std::string& log_hash,
  19. const std::string& log_signature,
  20. const ReportingInfo& reporting_info) {
  21. DCHECK(!is_uploading_);
  22. is_uploading_ = true;
  23. last_reporting_info_ = reporting_info;
  24. }
  25. } // namespace metrics