blob: 1bb1e84b557663e326224d82a03ff2540e93d7cc [file] [log] [blame]
Tianjie Xu282aa1f2017-09-05 13:42:45 -07001//
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
Amin Hassaniec7bc112020-10-29 16:47:58 -070017#ifndef UPDATE_ENGINE_COMMON_MOCK_METRICS_REPORTER_H_
18#define UPDATE_ENGINE_COMMON_MOCK_METRICS_REPORTER_H_
Tianjie Xu282aa1f2017-09-05 13:42:45 -070019
Marton Hunyadya0302682018-05-16 18:52:13 +020020#include <string>
21
Tianjie Xu282aa1f2017-09-05 13:42:45 -070022#include <gmock/gmock.h>
23
Amin Hassaniec7bc112020-10-29 16:47:58 -070024#include "update_engine/common/metrics_reporter_interface.h"
Tianjie Xu282aa1f2017-09-05 13:42:45 -070025
26namespace chromeos_update_engine {
27
Tianjie Xu1f93d092017-10-09 12:13:29 -070028class MockMetricsReporter : public MetricsReporterInterface {
Tianjie Xu282aa1f2017-09-05 13:42:45 -070029 public:
30 MOCK_METHOD0(Initialize, void());
31
32 MOCK_METHOD1(ReportRollbackMetrics, void(metrics::RollbackResult result));
33
Marton Hunyadya0302682018-05-16 18:52:13 +020034 MOCK_METHOD2(ReportEnterpriseRollbackMetrics,
35 void(bool success, const std::string& rollback_version));
36
Tianjie Xu282aa1f2017-09-05 13:42:45 -070037 MOCK_METHOD1(ReportDailyMetrics, void(base::TimeDelta os_age));
38
Amin Hassani538bd592020-11-04 20:46:08 -080039 MOCK_METHOD3(ReportUpdateCheckMetrics,
40 void(metrics::CheckResult result,
Tianjie Xu282aa1f2017-09-05 13:42:45 -070041 metrics::CheckReaction reaction,
42 metrics::DownloadErrorCode download_error_code));
43
Amin Hassani538bd592020-11-04 20:46:08 -080044 MOCK_METHOD7(ReportUpdateAttemptMetrics,
45 void(int attempt_number,
Tianjie Xu1f93d092017-10-09 12:13:29 -070046 PayloadType payload_type,
47 base::TimeDelta duration,
48 base::TimeDelta duration_uptime,
49 int64_t payload_size,
50 metrics::AttemptResult attempt_result,
51 ErrorCode internal_error_code));
52
53 MOCK_METHOD5(ReportUpdateAttemptDownloadMetrics,
54 void(int64_t payload_bytes_downloaded,
55 int64_t payload_download_speed_bps,
56 DownloadSource download_source,
57 metrics::DownloadErrorCode payload_download_error_code,
58 metrics::ConnectionType connection_type));
Tianjie Xu282aa1f2017-09-05 13:42:45 -070059
60 MOCK_METHOD0(ReportAbnormallyTerminatedUpdateAttemptMetrics, void());
61
Sen Jiang8712e962018-05-08 12:12:28 -070062 MOCK_METHOD10(ReportSuccessfulUpdateMetrics,
63 void(int attempt_count,
64 int updates_abandoned_count,
65 PayloadType payload_type,
66 int64_t payload_size,
67 int64_t num_bytes_downloaded[kNumDownloadSources],
68 int download_overhead_percentage,
69 base::TimeDelta total_duration,
70 base::TimeDelta total_duration_uptime,
71 int reboot_count,
72 int url_switch_count));
Tianjie Xu282aa1f2017-09-05 13:42:45 -070073
74 MOCK_METHOD2(ReportCertificateCheckMetrics,
75 void(ServerToCheck server_to_check,
76 CertificateCheckResult result));
77
78 MOCK_METHOD1(ReportFailedUpdateCount, void(int target_attempt));
79
80 MOCK_METHOD1(ReportTimeToReboot, void(int time_to_reboot_minutes));
81
82 MOCK_METHOD2(ReportInstallDateProvisioningSource, void(int source, int max));
Amin Hassani80f4d4c2018-05-16 13:34:00 -070083
84 MOCK_METHOD1(ReportInternalErrorCode, void(ErrorCode error_code));
Marton Hunyadyffbfdfb2018-05-30 13:03:29 +020085
86 MOCK_METHOD3(ReportKeyVersionMetrics,
87 void(int kernel_min_version,
88 int kernel_max_rollforward_version,
89 bool kernel_max_rollforward_success));
May Lippert60aa3ca2018-08-15 16:55:29 -070090
91 MOCK_METHOD2(ReportEnterpriseUpdateSeenToDownloadDays,
92 void(bool has_time_restriction_policy, int time_to_update_days));
Tianjie Xu282aa1f2017-09-05 13:42:45 -070093};
94
95} // namespace chromeos_update_engine
96
Amin Hassaniec7bc112020-10-29 16:47:58 -070097#endif // UPDATE_ENGINE_COMMON_MOCK_METRICS_REPORTER_H_