blob: 60982a7b2665b59e9014a024471cc2aee081774a [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
26class MockMetrics : public MetricsReporterInterface {
27 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
40 void ReportUpdateAttemptMetrics(
41 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 int64_t payload_bytes_downloaded,
48 int64_t payload_download_speed_bps,
49 DownloadSource download_source,
50 metrics::AttemptResult attempt_result,
51 ErrorCode internal_error_code,
52 metrics::DownloadErrorCode payload_download_error_code,
53 metrics::ConnectionType connection_type) override {}
54
55 MOCK_METHOD0(ReportAbnormallyTerminatedUpdateAttemptMetrics, void());
56
57 MOCK_METHOD9(ReportSuccessfulUpdateMetrics,
58 void(int attempt_count,
59 int updates_abandoned_count,
60 PayloadType payload_type,
61 int64_t payload_size,
62 int64_t num_bytes_downloaded[kNumDownloadSources],
63 int download_overhead_percentage,
64 base::TimeDelta total_duration,
65 int reboot_count,
66 int url_switch_count));
67
68 MOCK_METHOD2(ReportCertificateCheckMetrics,
69 void(ServerToCheck server_to_check,
70 CertificateCheckResult result));
71
72 MOCK_METHOD1(ReportFailedUpdateCount, void(int target_attempt));
73
74 MOCK_METHOD1(ReportTimeToReboot, void(int time_to_reboot_minutes));
75
76 MOCK_METHOD2(ReportInstallDateProvisioningSource, void(int source, int max));
77};
78
79} // namespace chromeos_update_engine
80
Tianjie Xu098f7022017-08-24 21:37:16 -070081#endif // UPDATE_ENGINE_MOCK_METRICS_REPORTER_H