1 /*
2 * Copyright 2021 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 /*
18 * Generated mock file from original source file
19 * Functions generated:12
20 *
21 * mockcify.pl ver 0.2
22 */
23
24 #include <cstdint>
25 #include <functional>
26 #include <map>
27 #include <string>
28
29 extern std::map<std::string, int> mock_function_count_map;
30
31 // Original included files, if any
32 // NOTE: Since this is a mock file with mock definitions some number of
33 // include files may not be required. The include-what-you-use
34 // still applies, but crafting proper inclusion is out of scope
35 // for this effort. This compilation unit may compile as-is, or
36 // may need attention to prune the inclusion set.
37 #include "gd/hci/address.h"
38 #include "gd/os/metrics.h"
39 #include "main/shim/helpers.h"
40 #include "main/shim/metrics_api.h"
41 #include "types/raw_address.h"
42
43 // Mock include file to share data between tests and mock
44 #include "test/mock/mock_main_shim_metrics_api.h"
45
46 // Mocked compile conditionals, if any
47 #ifndef UNUSED_ATTR
48 #define UNUSED_ATTR
49 #endif
50
51 // Mocked internal structures, if any
52
53 namespace test {
54 namespace mock {
55 namespace main_shim_metrics_api {
56
57 // Function state capture and return values, if needed
58 struct LogMetricLinkLayerConnectionEvent LogMetricLinkLayerConnectionEvent;
59 struct LogMetricA2dpAudioUnderrunEvent LogMetricA2dpAudioUnderrunEvent;
60 struct LogMetricA2dpAudioOverrunEvent LogMetricA2dpAudioOverrunEvent;
61 struct LogMetricA2dpPlaybackEvent LogMetricA2dpPlaybackEvent;
62 struct LogMetricReadRssiResult LogMetricReadRssiResult;
63 struct LogMetricReadFailedContactCounterResult
64 LogMetricReadFailedContactCounterResult;
65 struct LogMetricReadTxPowerLevelResult LogMetricReadTxPowerLevelResult;
66 struct LogMetricSmpPairingEvent LogMetricSmpPairingEvent;
67 struct LogMetricClassicPairingEvent LogMetricClassicPairingEvent;
68 struct LogMetricSdpAttribute LogMetricSdpAttribute;
69 struct LogMetricSocketConnectionState LogMetricSocketConnectionState;
70 struct LogMetricManufacturerInfo LogMetricManufacturerInfo;
71
72 } // namespace main_shim_metrics_api
73 } // namespace mock
74 } // namespace test
75
76 // Mocked functions, if any
LogMetricLinkLayerConnectionEvent(const RawAddress * raw_address,uint32_t connection_handle,android::bluetooth::DirectionEnum direction,uint16_t link_type,uint32_t hci_cmd,uint16_t hci_event,uint16_t hci_ble_event,uint16_t cmd_status,uint16_t reason_code)77 void bluetooth::shim::LogMetricLinkLayerConnectionEvent(
78 const RawAddress* raw_address, uint32_t connection_handle,
79 android::bluetooth::DirectionEnum direction, uint16_t link_type,
80 uint32_t hci_cmd, uint16_t hci_event, uint16_t hci_ble_event,
81 uint16_t cmd_status, uint16_t reason_code) {
82 mock_function_count_map[__func__]++;
83 test::mock::main_shim_metrics_api::LogMetricLinkLayerConnectionEvent(
84 raw_address, connection_handle, direction, link_type, hci_cmd, hci_event,
85 hci_ble_event, cmd_status, reason_code);
86 }
LogMetricA2dpAudioUnderrunEvent(const RawAddress & raw_address,uint64_t encoding_interval_millis,int num_missing_pcm_bytes)87 void bluetooth::shim::LogMetricA2dpAudioUnderrunEvent(
88 const RawAddress& raw_address, uint64_t encoding_interval_millis,
89 int num_missing_pcm_bytes) {
90 mock_function_count_map[__func__]++;
91 test::mock::main_shim_metrics_api::LogMetricA2dpAudioUnderrunEvent(
92 raw_address, encoding_interval_millis, num_missing_pcm_bytes);
93 }
LogMetricA2dpAudioOverrunEvent(const RawAddress & raw_address,uint64_t encoding_interval_millis,int num_dropped_buffers,int num_dropped_encoded_frames,int num_dropped_encoded_bytes)94 void bluetooth::shim::LogMetricA2dpAudioOverrunEvent(
95 const RawAddress& raw_address, uint64_t encoding_interval_millis,
96 int num_dropped_buffers, int num_dropped_encoded_frames,
97 int num_dropped_encoded_bytes) {
98 mock_function_count_map[__func__]++;
99 test::mock::main_shim_metrics_api::LogMetricA2dpAudioOverrunEvent(
100 raw_address, encoding_interval_millis, num_dropped_buffers,
101 num_dropped_encoded_frames, num_dropped_encoded_bytes);
102 }
LogMetricA2dpPlaybackEvent(const RawAddress & raw_address,int playback_state,int audio_coding_mode)103 void bluetooth::shim::LogMetricA2dpPlaybackEvent(const RawAddress& raw_address,
104 int playback_state,
105 int audio_coding_mode) {
106 mock_function_count_map[__func__]++;
107 test::mock::main_shim_metrics_api::LogMetricA2dpPlaybackEvent(
108 raw_address, playback_state, audio_coding_mode);
109 }
LogMetricReadRssiResult(const RawAddress & raw_address,uint16_t handle,uint32_t cmd_status,int8_t rssi)110 void bluetooth::shim::LogMetricReadRssiResult(const RawAddress& raw_address,
111 uint16_t handle,
112 uint32_t cmd_status,
113 int8_t rssi) {
114 mock_function_count_map[__func__]++;
115 test::mock::main_shim_metrics_api::LogMetricReadRssiResult(
116 raw_address, handle, cmd_status, rssi);
117 }
LogMetricReadFailedContactCounterResult(const RawAddress & raw_address,uint16_t handle,uint32_t cmd_status,int32_t failed_contact_counter)118 void bluetooth::shim::LogMetricReadFailedContactCounterResult(
119 const RawAddress& raw_address, uint16_t handle, uint32_t cmd_status,
120 int32_t failed_contact_counter) {
121 mock_function_count_map[__func__]++;
122 test::mock::main_shim_metrics_api::LogMetricReadFailedContactCounterResult(
123 raw_address, handle, cmd_status, failed_contact_counter);
124 }
LogMetricReadTxPowerLevelResult(const RawAddress & raw_address,uint16_t handle,uint32_t cmd_status,int32_t transmit_power_level)125 void bluetooth::shim::LogMetricReadTxPowerLevelResult(
126 const RawAddress& raw_address, uint16_t handle, uint32_t cmd_status,
127 int32_t transmit_power_level) {
128 mock_function_count_map[__func__]++;
129 test::mock::main_shim_metrics_api::LogMetricReadTxPowerLevelResult(
130 raw_address, handle, cmd_status, transmit_power_level);
131 }
LogMetricSmpPairingEvent(const RawAddress & raw_address,uint8_t smp_cmd,android::bluetooth::DirectionEnum direction,uint8_t smp_fail_reason)132 void bluetooth::shim::LogMetricSmpPairingEvent(
133 const RawAddress& raw_address, uint8_t smp_cmd,
134 android::bluetooth::DirectionEnum direction, uint8_t smp_fail_reason) {
135 mock_function_count_map[__func__]++;
136 test::mock::main_shim_metrics_api::LogMetricSmpPairingEvent(
137 raw_address, smp_cmd, direction, smp_fail_reason);
138 }
LogMetricClassicPairingEvent(const RawAddress & raw_address,uint16_t handle,uint32_t hci_cmd,uint16_t hci_event,uint16_t cmd_status,uint16_t reason_code,int64_t event_value)139 void bluetooth::shim::LogMetricClassicPairingEvent(
140 const RawAddress& raw_address, uint16_t handle, uint32_t hci_cmd,
141 uint16_t hci_event, uint16_t cmd_status, uint16_t reason_code,
142 int64_t event_value) {
143 mock_function_count_map[__func__]++;
144 test::mock::main_shim_metrics_api::LogMetricClassicPairingEvent(
145 raw_address, handle, hci_cmd, hci_event, cmd_status, reason_code,
146 event_value);
147 }
LogMetricSdpAttribute(const RawAddress & raw_address,uint16_t protocol_uuid,uint16_t attribute_id,size_t attribute_size,const char * attribute_value)148 void bluetooth::shim::LogMetricSdpAttribute(const RawAddress& raw_address,
149 uint16_t protocol_uuid,
150 uint16_t attribute_id,
151 size_t attribute_size,
152 const char* attribute_value) {
153 mock_function_count_map[__func__]++;
154 test::mock::main_shim_metrics_api::LogMetricSdpAttribute(
155 raw_address, protocol_uuid, attribute_id, attribute_size,
156 attribute_value);
157 }
LogMetricSocketConnectionState(const RawAddress & raw_address,int port,int type,android::bluetooth::SocketConnectionstateEnum connection_state,int64_t tx_bytes,int64_t rx_bytes,int uid,int server_port,android::bluetooth::SocketRoleEnum socket_role)158 void bluetooth::shim::LogMetricSocketConnectionState(
159 const RawAddress& raw_address, int port, int type,
160 android::bluetooth::SocketConnectionstateEnum connection_state,
161 int64_t tx_bytes, int64_t rx_bytes, int uid, int server_port,
162 android::bluetooth::SocketRoleEnum socket_role) {
163 mock_function_count_map[__func__]++;
164 test::mock::main_shim_metrics_api::LogMetricSocketConnectionState(
165 raw_address, port, type, connection_state, tx_bytes, rx_bytes, uid,
166 server_port, socket_role);
167 }
LogMetricManufacturerInfo(const RawAddress & raw_address,android::bluetooth::DeviceInfoSrcEnum source_type,const std::string & source_name,const std::string & manufacturer,const std::string & model,const std::string & hardware_version,const std::string & software_version)168 void bluetooth::shim::LogMetricManufacturerInfo(
169 const RawAddress& raw_address,
170 android::bluetooth::DeviceInfoSrcEnum source_type,
171 const std::string& source_name, const std::string& manufacturer,
172 const std::string& model, const std::string& hardware_version,
173 const std::string& software_version) {
174 mock_function_count_map[__func__]++;
175 test::mock::main_shim_metrics_api::LogMetricManufacturerInfo(
176 raw_address, source_type, source_name, manufacturer, model,
177 hardware_version, software_version);
178 }
179
180 // END mockcify generation
181