blob: a0f164b6cb9afee15e0c1fc39e2f3da411ea651c [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
Tianjie Xu098f7022017-08-24 21:37:16 -070017#ifndef UPDATE_ENGINE_MOCK_METRICS_REPORTER_H
18#define UPDATE_ENGINE_MOCK_METRICS_REPORTER_H
Tianjie Xu282aa1f2017-09-05 13:42:45 -070019
20#include <gmock/gmock.h>
21
22#include "update_engine/metrics_reporter_interface.h"
23
24namespace chromeos_update_engine {
25
Tianjie Xu1f93d092017-10-09 12:13:29 -070026class MockMetricsReporter : public MetricsReporterInterface {
Tianjie Xu282aa1f2017-09-05 13:42:45 -070027 public:
28 MOCK_METHOD0(Initialize, void());
29
30 MOCK_METHOD1(ReportRollbackMetrics, void(metrics::RollbackResult result));
31
32 MOCK_METHOD1(ReportDailyMetrics, void(base::TimeDelta os_age));
33
34 MOCK_METHOD4(ReportUpdateCheckMetrics,
35 void(SystemState* system_state,
36 metrics::CheckResult result,
37 metrics::CheckReaction reaction,
38 metrics::DownloadErrorCode download_error_code));
39
Tianjie Xu1f93d092017-10-09 12:13:29 -070040 MOCK_METHOD8(ReportUpdateAttemptMetrics,
41 void(SystemState* system_state,
42 int attempt_number,
43 PayloadType payload_type,
44 base::TimeDelta duration,
45 base::TimeDelta duration_uptime,
46 int64_t payload_size,
47 metrics::AttemptResult attempt_result,
48 ErrorCode internal_error_code));
49
50 MOCK_METHOD5(ReportUpdateAttemptDownloadMetrics,
51 void(int64_t payload_bytes_downloaded,
52 int64_t payload_download_speed_bps,
53 DownloadSource download_source,
54 metrics::DownloadErrorCode payload_download_error_code,
55 metrics::ConnectionType connection_type));
Tianjie Xu282aa1f2017-09-05 13:42:45 -070056
57 MOCK_METHOD0(ReportAbnormallyTerminatedUpdateAttemptMetrics, void());
58
59 MOCK_METHOD9(ReportSuccessfulUpdateMetrics,
60 void(int attempt_count,
61 int updates_abandoned_count,
62 PayloadType payload_type,
63 int64_t payload_size,
64 int64_t num_bytes_downloaded[kNumDownloadSources],
65 int download_overhead_percentage,
66 base::TimeDelta total_duration,
67 int reboot_count,
68 int url_switch_count));
69
70 MOCK_METHOD2(ReportCertificateCheckMetrics,
71 void(ServerToCheck server_to_check,
72 CertificateCheckResult result));
73
74 MOCK_METHOD1(ReportFailedUpdateCount, void(int target_attempt));
75
76 MOCK_METHOD1(ReportTimeToReboot, void(int time_to_reboot_minutes));
77
78 MOCK_METHOD2(ReportInstallDateProvisioningSource, void(int source, int max));
79};
80
81} // namespace chromeos_update_engine
82
Tianjie Xu098f7022017-08-24 21:37:16 -070083#endif // UPDATE_ENGINE_MOCK_METRICS_REPORTER_H