| Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame] | 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 |  | 
| Sen Jiang | 96e3672 | 2018-05-09 15:17:41 -0700 | [diff] [blame] | 17 | #ifndef UPDATE_ENGINE_MOCK_METRICS_REPORTER_H_ | 
|  | 18 | #define UPDATE_ENGINE_MOCK_METRICS_REPORTER_H_ | 
| Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame] | 19 |  | 
| Marton Hunyady | a030268 | 2018-05-16 18:52:13 +0200 | [diff] [blame] | 20 | #include <string> | 
|  | 21 |  | 
| Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame] | 22 | #include <gmock/gmock.h> | 
|  | 23 |  | 
|  | 24 | #include "update_engine/metrics_reporter_interface.h" | 
|  | 25 |  | 
|  | 26 | namespace chromeos_update_engine { | 
|  | 27 |  | 
| Tianjie Xu | 1f93d09 | 2017-10-09 12:13:29 -0700 | [diff] [blame] | 28 | class MockMetricsReporter : public MetricsReporterInterface { | 
| Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame] | 29 | public: | 
|  | 30 | MOCK_METHOD0(Initialize, void()); | 
|  | 31 |  | 
|  | 32 | MOCK_METHOD1(ReportRollbackMetrics, void(metrics::RollbackResult result)); | 
|  | 33 |  | 
| Marton Hunyady | a030268 | 2018-05-16 18:52:13 +0200 | [diff] [blame] | 34 | MOCK_METHOD2(ReportEnterpriseRollbackMetrics, | 
|  | 35 | void(bool success, const std::string& rollback_version)); | 
|  | 36 |  | 
| Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame] | 37 | MOCK_METHOD1(ReportDailyMetrics, void(base::TimeDelta os_age)); | 
|  | 38 |  | 
|  | 39 | MOCK_METHOD4(ReportUpdateCheckMetrics, | 
|  | 40 | void(SystemState* system_state, | 
|  | 41 | metrics::CheckResult result, | 
|  | 42 | metrics::CheckReaction reaction, | 
|  | 43 | metrics::DownloadErrorCode download_error_code)); | 
|  | 44 |  | 
| Tianjie Xu | 1f93d09 | 2017-10-09 12:13:29 -0700 | [diff] [blame] | 45 | MOCK_METHOD8(ReportUpdateAttemptMetrics, | 
|  | 46 | void(SystemState* system_state, | 
|  | 47 | int attempt_number, | 
|  | 48 | PayloadType payload_type, | 
|  | 49 | base::TimeDelta duration, | 
|  | 50 | base::TimeDelta duration_uptime, | 
|  | 51 | int64_t payload_size, | 
|  | 52 | metrics::AttemptResult attempt_result, | 
|  | 53 | ErrorCode internal_error_code)); | 
|  | 54 |  | 
|  | 55 | MOCK_METHOD5(ReportUpdateAttemptDownloadMetrics, | 
|  | 56 | void(int64_t payload_bytes_downloaded, | 
|  | 57 | int64_t payload_download_speed_bps, | 
|  | 58 | DownloadSource download_source, | 
|  | 59 | metrics::DownloadErrorCode payload_download_error_code, | 
|  | 60 | metrics::ConnectionType connection_type)); | 
| Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame] | 61 |  | 
|  | 62 | MOCK_METHOD0(ReportAbnormallyTerminatedUpdateAttemptMetrics, void()); | 
|  | 63 |  | 
| Sen Jiang | 8712e96 | 2018-05-08 12:12:28 -0700 | [diff] [blame] | 64 | MOCK_METHOD10(ReportSuccessfulUpdateMetrics, | 
|  | 65 | void(int attempt_count, | 
|  | 66 | int updates_abandoned_count, | 
|  | 67 | PayloadType payload_type, | 
|  | 68 | int64_t payload_size, | 
|  | 69 | int64_t num_bytes_downloaded[kNumDownloadSources], | 
|  | 70 | int download_overhead_percentage, | 
|  | 71 | base::TimeDelta total_duration, | 
|  | 72 | base::TimeDelta total_duration_uptime, | 
|  | 73 | int reboot_count, | 
|  | 74 | int url_switch_count)); | 
| Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame] | 75 |  | 
|  | 76 | MOCK_METHOD2(ReportCertificateCheckMetrics, | 
|  | 77 | void(ServerToCheck server_to_check, | 
|  | 78 | CertificateCheckResult result)); | 
|  | 79 |  | 
|  | 80 | MOCK_METHOD1(ReportFailedUpdateCount, void(int target_attempt)); | 
|  | 81 |  | 
|  | 82 | MOCK_METHOD1(ReportTimeToReboot, void(int time_to_reboot_minutes)); | 
|  | 83 |  | 
|  | 84 | MOCK_METHOD2(ReportInstallDateProvisioningSource, void(int source, int max)); | 
| Amin Hassani | 80f4d4c | 2018-05-16 13:34:00 -0700 | [diff] [blame] | 85 |  | 
|  | 86 | MOCK_METHOD1(ReportInternalErrorCode, void(ErrorCode error_code)); | 
| Marton Hunyady | ffbfdfb | 2018-05-30 13:03:29 +0200 | [diff] [blame] | 87 |  | 
|  | 88 | MOCK_METHOD3(ReportKeyVersionMetrics, | 
|  | 89 | void(int kernel_min_version, | 
|  | 90 | int kernel_max_rollforward_version, | 
|  | 91 | bool kernel_max_rollforward_success)); | 
| May Lippert | 60aa3ca | 2018-08-15 16:55:29 -0700 | [diff] [blame] | 92 |  | 
|  | 93 | MOCK_METHOD2(ReportEnterpriseUpdateSeenToDownloadDays, | 
|  | 94 | void(bool has_time_restriction_policy, int time_to_update_days)); | 
| Tianjie Xu | 282aa1f | 2017-09-05 13:42:45 -0700 | [diff] [blame] | 95 | }; | 
|  | 96 |  | 
|  | 97 | }  // namespace chromeos_update_engine | 
|  | 98 |  | 
| Sen Jiang | 96e3672 | 2018-05-09 15:17:41 -0700 | [diff] [blame] | 99 | #endif  // UPDATE_ENGINE_MOCK_METRICS_REPORTER_H_ |