mock_metrics_reporter.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. //
  2. // Copyright (C) 2017 The Android Open Source Project
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. //
  16. #ifndef UPDATE_ENGINE_MOCK_METRICS_REPORTER_H_
  17. #define UPDATE_ENGINE_MOCK_METRICS_REPORTER_H_
  18. #include <string>
  19. #include <gmock/gmock.h>
  20. #include "update_engine/metrics_reporter_interface.h"
  21. namespace chromeos_update_engine {
  22. class MockMetricsReporter : public MetricsReporterInterface {
  23. public:
  24. MOCK_METHOD0(Initialize, void());
  25. MOCK_METHOD1(ReportRollbackMetrics, void(metrics::RollbackResult result));
  26. MOCK_METHOD2(ReportEnterpriseRollbackMetrics,
  27. void(bool success, const std::string& rollback_version));
  28. MOCK_METHOD1(ReportDailyMetrics, void(base::TimeDelta os_age));
  29. MOCK_METHOD4(ReportUpdateCheckMetrics,
  30. void(SystemState* system_state,
  31. metrics::CheckResult result,
  32. metrics::CheckReaction reaction,
  33. metrics::DownloadErrorCode download_error_code));
  34. MOCK_METHOD8(ReportUpdateAttemptMetrics,
  35. void(SystemState* system_state,
  36. int attempt_number,
  37. PayloadType payload_type,
  38. base::TimeDelta duration,
  39. base::TimeDelta duration_uptime,
  40. int64_t payload_size,
  41. metrics::AttemptResult attempt_result,
  42. ErrorCode internal_error_code));
  43. MOCK_METHOD5(ReportUpdateAttemptDownloadMetrics,
  44. void(int64_t payload_bytes_downloaded,
  45. int64_t payload_download_speed_bps,
  46. DownloadSource download_source,
  47. metrics::DownloadErrorCode payload_download_error_code,
  48. metrics::ConnectionType connection_type));
  49. MOCK_METHOD0(ReportAbnormallyTerminatedUpdateAttemptMetrics, void());
  50. MOCK_METHOD10(ReportSuccessfulUpdateMetrics,
  51. void(int attempt_count,
  52. int updates_abandoned_count,
  53. PayloadType payload_type,
  54. int64_t payload_size,
  55. int64_t num_bytes_downloaded[kNumDownloadSources],
  56. int download_overhead_percentage,
  57. base::TimeDelta total_duration,
  58. base::TimeDelta total_duration_uptime,
  59. int reboot_count,
  60. int url_switch_count));
  61. MOCK_METHOD2(ReportCertificateCheckMetrics,
  62. void(ServerToCheck server_to_check,
  63. CertificateCheckResult result));
  64. MOCK_METHOD1(ReportFailedUpdateCount, void(int target_attempt));
  65. MOCK_METHOD1(ReportTimeToReboot, void(int time_to_reboot_minutes));
  66. MOCK_METHOD2(ReportInstallDateProvisioningSource, void(int source, int max));
  67. MOCK_METHOD1(ReportInternalErrorCode, void(ErrorCode error_code));
  68. MOCK_METHOD3(ReportKeyVersionMetrics,
  69. void(int kernel_min_version,
  70. int kernel_max_rollforward_version,
  71. bool kernel_max_rollforward_success));
  72. MOCK_METHOD2(ReportEnterpriseUpdateSeenToDownloadDays,
  73. void(bool has_time_restriction_policy, int time_to_update_days));
  74. };
  75. } // namespace chromeos_update_engine
  76. #endif // UPDATE_ENGINE_MOCK_METRICS_REPORTER_H_