• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
17 #ifndef UPDATE_ENGINE_MOCK_METRICS_REPORTER_H
18 #define UPDATE_ENGINE_MOCK_METRICS_REPORTER_H
19 
20 #include <gmock/gmock.h>
21 
22 #include "update_engine/metrics_reporter_interface.h"
23 
24 namespace chromeos_update_engine {
25 
26 class MockMetricsReporter : 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   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));
56 
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 
83 #endif  // UPDATE_ENGINE_MOCK_METRICS_REPORTER_H
84