From 47ee7b325b1177cb749ba8416f3c0c6ce03fe94e Mon Sep 17 00:00:00 2001 From: Chris Manton <cmanton@google.com> Date: Mon, 26 Apr 2021 17:12:53 -0700 Subject: [PATCH] Re-point main/test/ to use common test/mock Toward testable code Bug: 163134718 Test: gd/cert/run Tag: #refactor Change-Id: I6f2d7a4a26858c416750bf35c47f70ec13f2f0f4 --- system/btif/Android.bp | 8 +- system/main/Android.bp | 24 +- .../test/common/mock_activity_attribution.cc | 35 -- system/main/test/common/mock_bta_dm_act.cc | 118 ----- system/main/test/common/mock_btm_ble_gap.cc | 213 --------- system/main/test/common/mock_btm_dev.cc | 112 ----- system/main/test/common/mock_btm_main.cc | 57 --- system/main/test/common/mock_btm_sec.cc | 297 ------------ system/main/test/common/mock_gatt_main.cc | 111 ----- system/main/test/common/mock_hcic_hcicmds.cc | 304 ------------ system/main/test/common/mock_stack_acl.cc | 439 ------------------ system/main/test/common/mock_stack_btm_ble.cc | 252 ---------- system/main/test/common/mock_stack_btm_sco.cc | 125 ----- system/main/test/main_shim_test.cc | 4 +- system/stack/Android.bp | 5 +- .../stack/test/common/mock_l2cap_l2c_api.cc | 177 ------- .../stack/test/common/mock_l2cap_l2c_ble.cc | 152 ------ .../stack/test/common/mock_l2cap_l2c_main.cc | 60 --- .../test/common/mock_stack_l2cap_link.cc} | 0 system/test/Android.bp | 22 + system/{main => }/test/common/main_handler.cc | 0 system/{main => }/test/common/main_handler.h | 0 system/test/mock/mock_bta_hearing_aid.cc | 1 - system/test/mock/mock_bta_vc.cc | 9 +- system/test/mock/mock_bta_vc_device.cc | 3 - .../common => test/mock}/mock_btif_core.cc | 0 .../test/common => test/mock}/mock_btif_dm.cc | 0 system/test/mock/mock_l2cap_main.cc | 60 --- .../mock/mock_main_shim_entry.cc} | 5 +- .../mock/mock_main_shim_entry.h} | 0 system/test/mock/mock_stack_a2dp_api.cc | 2 +- .../mock/mock_stack_acl_ble.cc} | 0 .../mock/mock_stack_acl_btm_pm.cc} | 0 system/test/mock/mock_stack_avct_api.cc | 1 - system/test/mock/mock_stack_avdt_api.cc | 2 +- system/test/mock/mock_stack_avrc_bld_tg.cc | 1 - system/test/mock/mock_stack_avrc_pars.ct.cc | 1 - system/test/mock/mock_stack_btm.cc | 29 -- .../mock/mock_stack_btm_ble_adv_filter.cc | 1 - .../test/mock/mock_stack_btm_ble_batchscan.cc | 1 - .../test/mock/mock_stack_btm_ble_multi_adv.cc | 4 +- system/test/mock/mock_stack_btm_devctl.cc | 1 - .../mock/mock_stack_btm_inq.cc} | 0 system/test/mock/mock_stack_gatt_main.cc | 4 +- .../mock/mock_stack_l2cap_ble.cc} | 0 .../mock/mock_stack_l2cap_link.cc} | 0 system/test/mock/mock_stack_l2cap_main.cc | 2 +- system/test/mock/mock_stack_pan_api.cc | 1 - 48 files changed, 50 insertions(+), 2593 deletions(-) delete mode 100644 system/main/test/common/mock_activity_attribution.cc delete mode 100644 system/main/test/common/mock_bta_dm_act.cc delete mode 100644 system/main/test/common/mock_btm_ble_gap.cc delete mode 100644 system/main/test/common/mock_btm_dev.cc delete mode 100644 system/main/test/common/mock_btm_main.cc delete mode 100644 system/main/test/common/mock_btm_sec.cc delete mode 100644 system/main/test/common/mock_gatt_main.cc delete mode 100644 system/main/test/common/mock_hcic_hcicmds.cc delete mode 100644 system/main/test/common/mock_stack_acl.cc delete mode 100644 system/main/test/common/mock_stack_btm_ble.cc delete mode 100644 system/main/test/common/mock_stack_btm_sco.cc delete mode 100644 system/stack/test/common/mock_l2cap_l2c_api.cc delete mode 100644 system/stack/test/common/mock_l2cap_l2c_ble.cc delete mode 100644 system/stack/test/common/mock_l2cap_l2c_main.cc rename system/{main/test/common/mock_l2cap_l2c_link.cc => stack/test/common/mock_stack_l2cap_link.cc} (100%) rename system/{main => }/test/common/main_handler.cc (100%) rename system/{main => }/test/common/main_handler.h (100%) rename system/{main/test/common => test/mock}/mock_btif_core.cc (100%) rename system/{main/test/common => test/mock}/mock_btif_dm.cc (100%) delete mode 100644 system/test/mock/mock_l2cap_main.cc rename system/{main/test/common/mock_entry.cc => test/mock/mock_main_shim_entry.cc} (93%) rename system/{main/test/common/mock_entry.h => test/mock/mock_main_shim_entry.h} (100%) rename system/{main/test/common/mock_acl_ble.cc => test/mock/mock_stack_acl_ble.cc} (100%) rename system/{main/test/common/mock_acl_btm_pm.cc => test/mock/mock_stack_acl_btm_pm.cc} (100%) rename system/{main/test/common/mock_btm_inq.cc => test/mock/mock_stack_btm_inq.cc} (100%) rename system/{main/test/common/mock_l2cap_l2c_ble.cc => test/mock/mock_stack_l2cap_ble.cc} (100%) rename system/{stack/test/common/mock_l2cap_l2c_link.cc => test/mock/mock_stack_l2cap_link.cc} (100%) diff --git a/system/btif/Android.bp b/system/btif/Android.bp index 3d8b77d74ce..36653fb8cbb 100644 --- a/system/btif/Android.bp +++ b/system/btif/Android.bp @@ -317,7 +317,6 @@ cc_test { "packages/modules/Bluetooth/system/bta/dm", "packages/modules/Bluetooth/system/bta/include", "packages/modules/Bluetooth/system/bta/sys", - "packages/modules/Bluetooth/system/btcore/include", "packages/modules/Bluetooth/system/btif/avrcp", "packages/modules/Bluetooth/system/btif/co", "packages/modules/Bluetooth/system/btif/include", @@ -353,6 +352,12 @@ cc_test { ":TestMockUdrv", "test/btif_stack_test.cc", ], + generated_headers: [ + "BluetoothGeneratedBundlerSchema_h_bfbs", + "BluetoothGeneratedDumpsysDataSchema_h", + "BluetoothGeneratedDumpsysTestData_h", + "BluetoothGeneratedPackets_h", + ], header_libs: ["libbluetooth_headers"], shared_libs: [ "android.hardware.bluetooth.a2dp@1.0", @@ -360,6 +365,7 @@ cc_test { "android.hardware.bluetooth.audio@2.1", "libcrypto", "libcutils", + "libflatbuffers-cpp", "libhidlbase", "liblog", "libtinyxml2", diff --git a/system/main/Android.bp b/system/main/Android.bp index 6b2f42501f7..7f096596d22 100644 --- a/system/main/Android.bp +++ b/system/main/Android.bp @@ -216,6 +216,11 @@ cc_test { "packages/modules/Bluetooth/system/stack/include", ], srcs: [ + ":TestMockBta", + ":TestMockBtif", + ":TestMockLegacyHciCommands", + ":TestMockMainShimEntry", + ":TestMockStack", "shim/acl_api.cc", "shim/acl.cc", "shim/acl_legacy_interface.cc", @@ -233,25 +238,6 @@ cc_test { "shim/metrics_api.cc", "shim/shim.cc", "shim/stack.cc", - "test/common/main_handler.cc", - "test/common/mock_acl_ble.cc", - "test/common/mock_acl_btm_pm.cc", - "test/common/mock_bta_dm_act.cc", - "test/common/mock_btif_core.cc", - "test/common/mock_btif_dm.cc", - "test/common/mock_btm_ble_gap.cc", - "test/common/mock_btm_dev.cc", - "test/common/mock_btm_inq.cc", - "test/common/mock_btm_main.cc", - "test/common/mock_btm_sec.cc", - "test/common/mock_entry.cc", - "test/common/mock_gatt_main.cc", - "test/common/mock_hcic_hcicmds.cc", - "test/common/mock_l2cap_l2c_ble.cc", - "test/common/mock_l2cap_l2c_link.cc", - "test/common/mock_stack_acl.cc", - "test/common/mock_stack_btm_ble.cc", - "test/common/mock_stack_btm_sco.cc", "test/main_shim_test.cc", ], static_libs: [ diff --git a/system/main/test/common/mock_activity_attribution.cc b/system/main/test/common/mock_activity_attribution.cc deleted file mode 100644 index 49dc396fc14..00000000000 --- a/system/main/test/common/mock_activity_attribution.cc +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "module.h" - -#include "btif/include/btif_activity_attribution.h" -#include "main/shim/activity_attribution.h" -#include "main/shim/shim.h" - -ActivityAttributionInterface* -bluetooth::activity_attribution::get_activity_attribution_instance() { - return nullptr; -} - -ActivityAttributionInterface* -bluetooth::shim::get_activity_attribution_instance() { - return nullptr; -} - -const bluetooth::ModuleFactory - bluetooth::activity_attribution::ActivityAttribution::Factory = - bluetooth::ModuleFactory([]() { return nullptr; }); diff --git a/system/main/test/common/mock_bta_dm_act.cc b/system/main/test/common/mock_bta_dm_act.cc deleted file mode 100644 index 227641a2095..00000000000 --- a/system/main/test/common/mock_bta_dm_act.cc +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Generated mock file from original source file - * Functions generated:53 - */ - -#include <map> -#include <string> - -extern std::map<std::string, int> mock_function_count_map; - -#include "bta/dm/bta_dm_int.h" -#include "types/raw_address.h" - -#ifndef UNUSED_ATTR -#define UNUSED_ATTR -#endif - -void BTA_dm_acl_down(const RawAddress bd_addr, tBT_TRANSPORT transport) { - mock_function_count_map[__func__]++; -} -void BTA_dm_acl_up(const RawAddress bd_addr, tBT_TRANSPORT transport) { - mock_function_count_map[__func__]++; -} -void BTA_dm_notify_remote_features_complete(const RawAddress bd_addr) { - mock_function_count_map[__func__]++; -} - -void BTA_dm_on_hw_off() { mock_function_count_map[__func__]++; } -void BTA_dm_on_hw_on() { mock_function_count_map[__func__]++; } -void BTA_dm_report_role_change(const RawAddress bd_addr, uint8_t new_role, - tHCI_STATUS hci_status) { - mock_function_count_map[__func__]++; -} -void bta_dm_add_device(std::unique_ptr<tBTA_DM_API_ADD_DEVICE> msg) { - mock_function_count_map[__func__]++; -} -void bta_dm_bond(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type, - tBT_TRANSPORT transport, int device_type) { - mock_function_count_map[__func__]++; -} -void bta_dm_bond_cancel(const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; -} -void bta_dm_ci_rmt_oob_act(std::unique_ptr<tBTA_DM_CI_RMT_OOB> msg) { - mock_function_count_map[__func__]++; -} -void bta_dm_close_acl(const RawAddress& bd_addr, bool remove_dev, - tBT_TRANSPORT transport) { - mock_function_count_map[__func__]++; -} -void bta_dm_confirm(const RawAddress& bd_addr, bool accept) { - mock_function_count_map[__func__]++; -} -void bta_dm_deinit_cb(void) { mock_function_count_map[__func__]++; } -void bta_dm_disable() { mock_function_count_map[__func__]++; } -void bta_dm_disc_result(tBTA_DM_MSG* p_data) { - mock_function_count_map[__func__]++; -} -void bta_dm_disc_rmt_name(tBTA_DM_MSG* p_data) { - mock_function_count_map[__func__]++; -} -void bta_dm_discover(tBTA_DM_MSG* p_data) { - mock_function_count_map[__func__]++; -} -void bta_dm_free_sdp_db() { mock_function_count_map[__func__]++; } -void bta_dm_init_cb(void) { mock_function_count_map[__func__]++; } -void bta_dm_inq_cmpl(uint8_t num) { mock_function_count_map[__func__]++; } -void bta_dm_pin_reply(std::unique_ptr<tBTA_DM_API_PIN_REPLY> msg) { - mock_function_count_map[__func__]++; -} -void bta_dm_process_remove_device(const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; -} -void bta_dm_queue_disc(tBTA_DM_MSG* p_data) { - mock_function_count_map[__func__]++; -} -void bta_dm_queue_search(tBTA_DM_MSG* p_data) { - mock_function_count_map[__func__]++; -} -void bta_dm_remove_device(const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; -} -void bta_dm_rmt_name(tBTA_DM_MSG* p_data) { - mock_function_count_map[__func__]++; -} -void bta_dm_sdp_result(tBTA_DM_MSG* p_data) { - mock_function_count_map[__func__]++; -} -void bta_dm_search_cancel() { mock_function_count_map[__func__]++; } -void bta_dm_search_cancel_cmpl() { mock_function_count_map[__func__]++; } -void bta_dm_search_cancel_notify() { mock_function_count_map[__func__]++; } -void bta_dm_search_clear_queue() { mock_function_count_map[__func__]++; } -void bta_dm_search_cmpl() { mock_function_count_map[__func__]++; } -void bta_dm_search_result(tBTA_DM_MSG* p_data) { - mock_function_count_map[__func__]++; -} -void bta_dm_search_start(tBTA_DM_MSG* p_data) { - mock_function_count_map[__func__]++; -} -void bta_dm_set_dev_name(const std::vector<uint8_t>& name) { - mock_function_count_map[__func__]++; -} diff --git a/system/main/test/common/mock_btm_ble_gap.cc b/system/main/test/common/mock_btm_ble_gap.cc deleted file mode 100644 index 22e18a6d21e..00000000000 --- a/system/main/test/common/mock_btm_ble_gap.cc +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Generated mock file from original source file - * Functions generated:47 - */ - -#include <map> -#include <string> - -extern std::map<std::string, int> mock_function_count_map; - -#include <base/bind.h> -#include <base/strings/string_number_conversions.h> -#include <cstdint> -#include <list> -#include <memory> -#include <vector> -#include "common/time_util.h" -#include "device/include/controller.h" -#include "main/shim/acl_api.h" -#include "main/shim/btm_api.h" -#include "main/shim/shim.h" -#include "osi/include/log.h" -#include "stack/btm/btm_ble_int.h" -#include "stack/btm/btm_ble_int_types.h" -#include "stack/btm/btm_dev.h" -#include "stack/btm/btm_int_types.h" -#include "stack/gatt/gatt_int.h" -#include "stack/include/acl_api.h" -#include "stack/include/advertise_data_parser.h" -#include "stack/include/bt_types.h" -#include "stack/include/btm_api_types.h" -#include "stack/include/gap_api.h" -#include "stack/include/hci_error_code.h" -#include "stack/include/hcimsgs.h" -#include "stack/include/inq_hci_link_interface.h" -#include "types/raw_address.h" - -#ifndef UNUSED_ATTR -#define UNUSED_ATTR -#endif - -bool BTM_BleConfigPrivacy(bool privacy_mode) { - mock_function_count_map[__func__]++; - return false; -} -bool BTM_BleLocalPrivacyEnabled(void) { - mock_function_count_map[__func__]++; - return false; -} -bool btm_ble_cancel_remote_name(const RawAddress& remote_bda) { - mock_function_count_map[__func__]++; - return false; -} -bool btm_ble_clear_topology_mask(tBTM_BLE_STATE_MASK request_state_mask) { - mock_function_count_map[__func__]++; - return false; -} -bool btm_ble_set_topology_mask(tBTM_BLE_STATE_MASK request_state_mask) { - mock_function_count_map[__func__]++; - return false; -} -bool btm_ble_topology_check(tBTM_BLE_STATE_MASK request_state_mask) { - mock_function_count_map[__func__]++; - return false; -} -tBTM_STATUS BTM_BleObserve(bool start, uint8_t duration, - tBTM_INQ_RESULTS_CB* p_results_cb, - tBTM_CMPL_CB* p_cmpl_cb) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS btm_ble_read_remote_name(const RawAddress& remote_bda, - tBTM_CMPL_CB* p_cb) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS btm_ble_set_connectability(uint16_t combined_mode) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS btm_ble_set_discoverability(uint16_t combined_mode) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS btm_ble_start_adv(void) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS btm_ble_start_inquiry(uint8_t duration) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS btm_ble_stop_adv(void) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -uint16_t BTM_BleReadConnectability() { - mock_function_count_map[__func__]++; - return 0; -} -uint16_t BTM_BleReadDiscoverability() { - mock_function_count_map[__func__]++; - return 0; -} -uint8_t BTM_BleMaxMultiAdvInstanceCount(void) { - mock_function_count_map[__func__]++; - return 0; -} -void BTM_BleGetDynamicAudioBuffer( - tBTM_BT_DYNAMIC_AUDIO_BUFFER_CB p_dynamic_audio_buffer_cb[]) { - mock_function_count_map[__func__]++; -} -void BTM_BleGetVendorCapabilities(tBTM_BLE_VSC_CB* p_cmn_vsc_cb) { - mock_function_count_map[__func__]++; -} -void BTM_BleSetScanParams(uint32_t scan_interval, uint32_t scan_window, - tBLE_SCAN_MODE scan_mode, - base::Callback<void(uint8_t)> cb) { - mock_function_count_map[__func__]++; -} -void btm_ble_decrement_link_topology_mask(uint8_t link_role) { - mock_function_count_map[__func__]++; -} -void btm_ble_dir_adv_tout(void) { mock_function_count_map[__func__]++; } -void btm_ble_free() { mock_function_count_map[__func__]++; } -void btm_ble_increment_link_topology_mask(uint8_t link_role) { - mock_function_count_map[__func__]++; -} -void btm_ble_init(void) { mock_function_count_map[__func__]++; } -void btm_ble_process_adv_addr(RawAddress& bda, uint8_t* addr_type) { - mock_function_count_map[__func__]++; -} -void btm_ble_process_adv_pkt(uint8_t data_len, uint8_t* data) { - mock_function_count_map[__func__]++; -} -void btm_ble_process_adv_pkt_cont(uint16_t evt_type, uint8_t addr_type, - const RawAddress& bda, uint8_t primary_phy, - uint8_t secondary_phy, - uint8_t advertising_sid, int8_t tx_power, - int8_t rssi, uint16_t periodic_adv_int, - uint8_t data_len, uint8_t* data) { - mock_function_count_map[__func__]++; -} -void btm_ble_process_adv_pkt_cont_for_inquiry( - uint16_t evt_type, uint8_t addr_type, const RawAddress& bda, - uint8_t primary_phy, uint8_t secondary_phy, uint8_t advertising_sid, - int8_t tx_power, int8_t rssi, uint16_t periodic_adv_int, - std::vector<uint8_t> advertising_data) { - mock_function_count_map[__func__]++; -} -void btm_ble_process_ext_adv_pkt(uint8_t data_len, uint8_t* data) { - mock_function_count_map[__func__]++; -} -void btm_ble_process_phy_update_pkt(uint8_t len, uint8_t* data) { - mock_function_count_map[__func__]++; -} -void btm_ble_read_remote_features_complete(uint8_t* p) { - mock_function_count_map[__func__]++; -} -void btm_ble_read_remote_name_cmpl(bool status, const RawAddress& bda, - uint16_t length, char* p_name) { - mock_function_count_map[__func__]++; -} -void btm_ble_set_adv_flag(uint16_t connect_mode, uint16_t disc_mode) { - mock_function_count_map[__func__]++; -} -void btm_ble_start_scan() { mock_function_count_map[__func__]++; } -void btm_ble_stop_inquiry(void) { mock_function_count_map[__func__]++; } -void btm_ble_stop_scan(void) { mock_function_count_map[__func__]++; } -void btm_ble_update_dmt_flag_bits(uint8_t* adv_flag_value, - const uint16_t connect_mode, - const uint16_t disc_mode) { - mock_function_count_map[__func__]++; -} -void btm_ble_update_inq_result(tINQ_DB_ENT* p_i, uint8_t addr_type, - const RawAddress& bda, uint16_t evt_type, - uint8_t primary_phy, uint8_t secondary_phy, - uint8_t advertising_sid, int8_t tx_power, - int8_t rssi, uint16_t periodic_adv_int, - std::vector<uint8_t> const& data) { - mock_function_count_map[__func__]++; -} -void btm_ble_update_mode_operation(uint8_t link_role, const RawAddress* bd_addr, - tHCI_STATUS status) { - mock_function_count_map[__func__]++; -} -void btm_ble_write_adv_enable_complete(uint8_t* p) { - mock_function_count_map[__func__]++; -} -void btm_clear_all_pending_le_entry(void) { - mock_function_count_map[__func__]++; -} -void btm_send_hci_set_scan_params(uint8_t scan_type, uint16_t scan_int, - uint16_t scan_win, uint8_t addr_type_own, - uint8_t scan_filter_policy) { - mock_function_count_map[__func__]++; -} diff --git a/system/main/test/common/mock_btm_dev.cc b/system/main/test/common/mock_btm_dev.cc deleted file mode 100644 index 85e8b10fd69..00000000000 --- a/system/main/test/common/mock_btm_dev.cc +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Generated mock file from original source file - * Functions generated:16 - */ - -#include <map> -#include <string> - -extern std::map<std::string, int> mock_function_count_map; - -#include <stddef.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include "bt_common.h" -#include "bt_types.h" -#include "btm_api.h" -#include "btu.h" -#include "device/include/controller.h" -#include "hcidefs.h" -#include "hcimsgs.h" -#include "l2c_api.h" -#include "main/shim/btm_api.h" -#include "main/shim/shim.h" -#include "stack/btm/btm_dev.h" -#include "stack/include/acl_api.h" - -#ifndef UNUSED_ATTR -#define UNUSED_ATTR -#endif - -bool BTM_SecAddDevice(const RawAddress& bd_addr, DEV_CLASS dev_class, - BD_NAME bd_name, uint8_t* features, LinkKey* p_link_key, - uint8_t key_type, uint8_t pin_length) { - mock_function_count_map[__func__]++; - return false; -} -bool BTM_SecDeleteDevice(const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; - return false; -} -bool btm_dev_support_role_switch(const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; - return false; -} -bool btm_set_bond_type_dev(const RawAddress& bd_addr, - tBTM_SEC_DEV_REC::tBTM_BOND_TYPE bond_type) { - mock_function_count_map[__func__]++; - return false; -} -bool is_address_equal(void* data, void* context) { - mock_function_count_map[__func__]++; - return false; -} -bool is_handle_equal(void* data, void* context) { - mock_function_count_map[__func__]++; - return false; -} -char* BTM_SecReadDevName(const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; - return nullptr; -} -tBTM_SEC_DEV_REC* btm_find_dev(const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; - return nullptr; -} -tBTM_SEC_DEV_REC* btm_find_dev_by_handle(uint16_t handle) { - mock_function_count_map[__func__]++; - return nullptr; -} -tBTM_SEC_DEV_REC* btm_find_or_alloc_dev(const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; - return nullptr; -} -tBTM_SEC_DEV_REC* btm_sec_alloc_dev(const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; - return nullptr; -} -tBTM_SEC_DEV_REC* btm_sec_allocate_dev_rec(void) { - mock_function_count_map[__func__]++; - return nullptr; -} -tBTM_SEC_DEV_REC::tBTM_BOND_TYPE btm_get_bond_type_dev( - const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; - return tBTM_SEC_DEV_REC::BOND_TYPE_UNKNOWN; -} -void BTM_SecClearSecurityFlags(const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; -} -void btm_consolidate_dev(tBTM_SEC_DEV_REC* p_target_rec) { - mock_function_count_map[__func__]++; -} -void wipe_secrets_and_remove(tBTM_SEC_DEV_REC* p_dev_rec) { - mock_function_count_map[__func__]++; -} diff --git a/system/main/test/common/mock_btm_main.cc b/system/main/test/common/mock_btm_main.cc deleted file mode 100644 index e614cc35e22..00000000000 --- a/system/main/test/common/mock_btm_main.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Generated mock file from original source file - * Functions generated:7 - */ - -#include <map> -#include <string> - -extern std::map<std::string, int> mock_function_count_map; - -#include <memory> -#include <string> -#include "bt_target.h" -#include "bt_types.h" -#include "main/shim/dumpsys.h" -#include "stack/btm/btm_int_types.h" -#include "stack/include/btm_client_interface.h" -#include "stack_config.h" - -#ifndef UNUSED_ATTR -#define UNUSED_ATTR -#endif - -void BTM_LogHistory(const std::string& tag, const RawAddress& bd_addr, - const std::string& msg) { - mock_function_count_map[__func__]++; -} -void BTM_LogHistory(const std::string& tag, const RawAddress& bd_addr, - const std::string& msg, const std::string& extra) { - mock_function_count_map[__func__]++; -} -void BTM_LogHistory(const std::string& tag, const tBLE_BD_ADDR& ble_bd_addr, - const std::string& msg) { - mock_function_count_map[__func__]++; -} -void BTM_LogHistory(const std::string& tag, const tBLE_BD_ADDR& ble_bd_addr, - const std::string& msg, const std::string& extra) { - mock_function_count_map[__func__]++; -} -void btm_free(void) { mock_function_count_map[__func__]++; } -void btm_init(void) { mock_function_count_map[__func__]++; } diff --git a/system/main/test/common/mock_btm_sec.cc b/system/main/test/common/mock_btm_sec.cc deleted file mode 100644 index 763fdfe9935..00000000000 --- a/system/main/test/common/mock_btm_sec.cc +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Copyright 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Generated mock file from original source file - * Functions generated:66 - */ - -#include <map> -#include <string> - -extern std::map<std::string, int> mock_function_count_map; - -#include <base/strings/stringprintf.h> -#include <frameworks/proto_logging/stats/enums/bluetooth/enums.pb.h> -#include <frameworks/proto_logging/stats/enums/bluetooth/hci/enums.pb.h> -#include <string.h> -#include "bt_types.h" -#include "btif/include/btif_storage.h" -#include "common/metrics.h" -#include "common/time_util.h" -#include "device/include/controller.h" -#include "hcimsgs.h" -#include "l2c_api.h" -#include "main/shim/btm_api.h" -#include "main/shim/dumpsys.h" -#include "main/shim/shim.h" -#include "osi/include/log.h" -#include "osi/include/osi.h" -#include "stack/btm/btm_dev.h" -#include "stack/btm/btm_sec.h" -#include "stack/include/acl_api.h" -#include "stack/include/acl_hci_link_interface.h" -#include "stack/include/btm_status.h" -#include "stack/include/l2cap_security_interface.h" -#include "stack/smp/smp_int.h" - -#ifndef UNUSED_ATTR -#define UNUSED_ATTR -#endif - -bool BTM_BothEndsSupportSecureConnections(const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; - return false; -} -bool BTM_GetSecurityFlags(const RawAddress& bd_addr, uint8_t* p_sec_flags) { - mock_function_count_map[__func__]++; - return false; -} -bool BTM_GetSecurityFlagsByTransport(const RawAddress& bd_addr, - uint8_t* p_sec_flags, - tBT_TRANSPORT transport) { - mock_function_count_map[__func__]++; - return false; -} -bool BTM_IsAuthenticated(const RawAddress& bd_addr, tBT_TRANSPORT transport) { - mock_function_count_map[__func__]++; - return false; -} -bool BTM_IsEncrypted(const RawAddress& bd_addr, tBT_TRANSPORT transport) { - mock_function_count_map[__func__]++; - return false; -} -bool BTM_IsLinkKeyAuthed(const RawAddress& bd_addr, tBT_TRANSPORT transport) { - mock_function_count_map[__func__]++; - return false; -} -bool BTM_IsLinkKeyKnown(const RawAddress& bd_addr, tBT_TRANSPORT transport) { - mock_function_count_map[__func__]++; - return false; -} -bool BTM_PeerSupportsSecureConnections(const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; - return false; -} -bool BTM_SecAddRmtNameNotifyCallback(tBTM_RMT_NAME_CALLBACK* p_callback) { - mock_function_count_map[__func__]++; - return false; -} -bool BTM_SecDeleteRmtNameNotifyCallback(tBTM_RMT_NAME_CALLBACK* p_callback) { - mock_function_count_map[__func__]++; - return false; -} -bool BTM_SecIsSecurityPending(const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; - return false; -} -bool BTM_SecRegister(const tBTM_APPL_INFO* p_cb_info) { - mock_function_count_map[__func__]++; - return false; -} -bool BTM_SetSecurityLevel(bool is_originator, const char* p_name, - uint8_t service_id, uint16_t sec_level, uint16_t psm, - uint32_t mx_proto_id, uint32_t mx_chan_id) { - mock_function_count_map[__func__]++; - return false; -} -bool btm_sec_is_a_bonded_dev(const RawAddress& bda) { - mock_function_count_map[__func__]++; - return false; -} -bool is_sec_state_equal(void* data, void* context) { - mock_function_count_map[__func__]++; - return false; -} -bool is_state_getting_name(void* data, void* context) { - mock_function_count_map[__func__]++; - return false; -} -const uint8_t* btm_get_dev_class(const RawAddress& bda) { - mock_function_count_map[__func__]++; - return nullptr; -} -tBTM_LINK_KEY_TYPE BTM_SecGetDeviceLinkKeyType(const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; - return 0; -} -tBTM_SEC_DEV_REC* btm_sec_find_dev_by_sec_state(uint8_t state) { - mock_function_count_map[__func__]++; - return nullptr; -} -tBTM_SEC_SERV_REC* btm_sec_find_first_serv(bool is_originator, uint16_t psm) { - mock_function_count_map[__func__]++; - return nullptr; -} -tBTM_STATUS BTM_SecBond(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type, - tBT_TRANSPORT transport, int device_type, - uint8_t pin_len, uint8_t* p_pin) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS BTM_SecBondCancel(const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS BTM_SetEncryption(const RawAddress& bd_addr, - tBT_TRANSPORT transport, - tBTM_SEC_CALLBACK* p_callback, void* p_ref_data, - tBTM_BLE_SEC_ACT sec_act) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS btm_sec_bond_by_transport(const RawAddress& bd_addr, - tBT_TRANSPORT transport, uint8_t pin_len, - uint8_t* p_pin) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS btm_sec_disconnect(uint16_t handle, tHCI_STATUS reason) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS btm_sec_execute_procedure(tBTM_SEC_DEV_REC* p_dev_rec) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS btm_sec_l2cap_access_req(const RawAddress& bd_addr, uint16_t psm, - bool is_originator, - tBTM_SEC_CALLBACK* p_callback, - void* p_ref_data) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS btm_sec_l2cap_access_req_by_requirement( - const RawAddress& bd_addr, uint16_t security_required, bool is_originator, - tBTM_SEC_CALLBACK* p_callback, void* p_ref_data) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS btm_sec_mx_access_request(const RawAddress& bd_addr, - bool is_originator, - uint16_t security_required, - tBTM_SEC_CALLBACK* p_callback, - void* p_ref_data) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -uint16_t BTM_GetClockOffset(const RawAddress& remote_bda) { - mock_function_count_map[__func__]++; - return 0; -} -uint8_t BTM_SecClrService(uint8_t service_id) { - mock_function_count_map[__func__]++; - return 0; -} -uint8_t BTM_SecClrServiceByPsm(uint16_t psm) { - mock_function_count_map[__func__]++; - return 0; -} -void BTM_ConfirmReqReply(tBTM_STATUS res, const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; -} -void BTM_PINCodeReply(const RawAddress& bd_addr, uint8_t res, uint8_t pin_len, - uint8_t* p_pin) { - mock_function_count_map[__func__]++; -} -void BTM_PasskeyReqReply(tBTM_STATUS res, const RawAddress& bd_addr, - uint32_t passkey) { - mock_function_count_map[__func__]++; -} -void BTM_ReadLocalOobData(void) { mock_function_count_map[__func__]++; } -void BTM_RemoteOobDataReply(tBTM_STATUS res, const RawAddress& bd_addr, - const Octet16& c, const Octet16& r) { - mock_function_count_map[__func__]++; -} -void BTM_SetPinType(uint8_t pin_type, PIN_CODE pin_code, uint8_t pin_code_len) { - mock_function_count_map[__func__]++; -} -void NotifyBondingCanceled(tBTM_STATUS btm_status) { - mock_function_count_map[__func__]++; -} -void btm_create_conn_cancel_complete(uint8_t* p) { - mock_function_count_map[__func__]++; -} -void btm_io_capabilities_req(const RawAddress& p) { - mock_function_count_map[__func__]++; -} -void btm_io_capabilities_rsp(uint8_t* p) { - mock_function_count_map[__func__]++; -} -void btm_proc_sp_req_evt(tBTM_SP_EVT event, uint8_t* p) { - mock_function_count_map[__func__]++; -} -void btm_read_local_oob_complete(uint8_t* p) { - mock_function_count_map[__func__]++; -} -void btm_rem_oob_req(uint8_t* p) { mock_function_count_map[__func__]++; } -void btm_sec_abort_access_req(const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; -} -void btm_sec_auth_complete(uint16_t handle, tHCI_STATUS status) { - mock_function_count_map[__func__]++; -} -void btm_sec_check_pending_reqs(void) { mock_function_count_map[__func__]++; } -void btm_sec_clear_ble_keys(tBTM_SEC_DEV_REC* p_dev_rec) { - mock_function_count_map[__func__]++; -} -void btm_sec_conn_req(const RawAddress& bda, uint8_t* dc) { - mock_function_count_map[__func__]++; -} -void btm_sec_connected(const RawAddress& bda, uint16_t handle, - tHCI_STATUS status, uint8_t enc_mode) { - mock_function_count_map[__func__]++; -} -void btm_sec_dev_rec_cback_event(tBTM_SEC_DEV_REC* p_dev_rec, - tBTM_STATUS btm_status, bool is_le_transport) { - mock_function_count_map[__func__]++; -} -void btm_sec_dev_reset(void) { mock_function_count_map[__func__]++; } -void btm_sec_disconnected(uint16_t handle, tHCI_REASON reason) { - mock_function_count_map[__func__]++; -} -void btm_sec_encrypt_change(uint16_t handle, tHCI_STATUS status, - uint8_t encr_enable) { - mock_function_count_map[__func__]++; -} -void btm_sec_link_key_notification(const RawAddress& p_bda, - const Octet16& link_key, uint8_t key_type) { - mock_function_count_map[__func__]++; -} -void btm_sec_link_key_request(uint8_t* p_event) { - mock_function_count_map[__func__]++; -} -void btm_sec_pin_code_request(uint8_t* p_event) { - mock_function_count_map[__func__]++; -} -void btm_sec_rmt_host_support_feat_evt(uint8_t* p) { - mock_function_count_map[__func__]++; -} -void btm_sec_rmt_name_request_complete(const RawAddress* p_bd_addr, - uint8_t* p_bd_name, tHCI_STATUS status) { - mock_function_count_map[__func__]++; -} -void btm_sec_set_peer_sec_caps(uint16_t hci_handle, bool ssp_supported, - bool sc_supported, - bool hci_role_switch_supported) { - mock_function_count_map[__func__]++; -} -void btm_sec_update_clock_offset(uint16_t handle, uint16_t clock_offset) { - mock_function_count_map[__func__]++; -} -void btm_simple_pair_complete(uint8_t* p) { - mock_function_count_map[__func__]++; -} diff --git a/system/main/test/common/mock_gatt_main.cc b/system/main/test/common/mock_gatt_main.cc deleted file mode 100644 index 4756039e386..00000000000 --- a/system/main/test/common/mock_gatt_main.cc +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Generated mock file from original source file - * Functions generated:23 - */ - -#include <map> -#include <string> - -extern std::map<std::string, int> mock_function_count_map; - -#include "bt_common.h" -#include "bt_target.h" -#include "device/include/interop.h" -#include "l2c_api.h" -#include "osi/include/osi.h" -#include "stack/btm/btm_ble_int.h" -#include "stack/btm/btm_dev.h" -#include "stack/btm/btm_sec.h" -#include "stack/gatt/gatt_int.h" -#include "stack/include/l2cap_acl_interface.h" - -#ifndef UNUSED_ATTR -#define UNUSED_ATTR -#endif - -bool gatt_act_connect(tGATT_REG* p_reg, const RawAddress& bd_addr, - tBT_TRANSPORT transport, int8_t initiating_phys) { - mock_function_count_map[__func__]++; - return false; -} -bool gatt_connect(const RawAddress& rem_bda, tGATT_TCB* p_tcb, - tBT_TRANSPORT transport, uint8_t initiating_phys, - tGATT_IF gatt_if) { - mock_function_count_map[__func__]++; - return false; -} -bool gatt_disconnect(tGATT_TCB* p_tcb) { - mock_function_count_map[__func__]++; - return false; -} -bool gatt_update_app_hold_link_status(tGATT_IF gatt_if, tGATT_TCB* p_tcb, - bool is_add) { - mock_function_count_map[__func__]++; - return false; -} -tGATT_CH_STATE gatt_get_ch_state(tGATT_TCB* p_tcb) { - mock_function_count_map[__func__]++; - return GATT_CH_CLOSE; -} -void gatt_add_a_bonded_dev_for_srv_chg(const RawAddress& bda) { - mock_function_count_map[__func__]++; -} -void gatt_chk_srv_chg(tGATTS_SRV_CHG* p_srv_chg_clt) { - mock_function_count_map[__func__]++; -} -void gatt_data_process(tGATT_TCB& tcb, uint16_t cid, BT_HDR* p_buf) { - mock_function_count_map[__func__]++; -} -void gatt_find_in_device_record(const RawAddress& bd_addr, - tBLE_BD_ADDR* address_with_type) { - mock_function_count_map[__func__]++; -} -void gatt_free(void) { mock_function_count_map[__func__]++; } -void gatt_init(void) { mock_function_count_map[__func__]++; } -void gatt_init_srv_chg(void) { mock_function_count_map[__func__]++; } -void gatt_l2cif_config_cfm_cback(uint16_t lcid, uint16_t initiator, - tL2CAP_CFG_INFO* p_cfg) { - mock_function_count_map[__func__]++; -} -void gatt_l2cif_config_ind_cback(uint16_t lcid, tL2CAP_CFG_INFO* p_cfg) { - mock_function_count_map[__func__]++; -} -void gatt_l2cif_disconnect_ind_cback(uint16_t lcid, bool ack_needed) { - mock_function_count_map[__func__]++; -} -void gatt_notify_conn_update(const RawAddress&, uint16_t interval, - uint16_t latency, uint16_t timeout, - tHCI_STATUS status) { - mock_function_count_map[__func__]++; -} -void gatt_notify_phy_updated(tGATT_STATUS status, uint16_t handle, - uint8_t tx_phy, uint8_t rx_phy) { - mock_function_count_map[__func__]++; -} -void gatt_proc_srv_chg(void) { mock_function_count_map[__func__]++; } -void gatt_send_srv_chg_ind(const RawAddress& peer_bda) { - mock_function_count_map[__func__]++; -} -void gatt_set_ch_state(tGATT_TCB* p_tcb, tGATT_CH_STATE ch_state) { - mock_function_count_map[__func__]++; -} -void gatt_update_app_use_link_flag(tGATT_IF gatt_if, tGATT_TCB* p_tcb, - bool is_add, bool check_acl_link) { - mock_function_count_map[__func__]++; -} diff --git a/system/main/test/common/mock_hcic_hcicmds.cc b/system/main/test/common/mock_hcic_hcicmds.cc deleted file mode 100644 index 18c8416b317..00000000000 --- a/system/main/test/common/mock_hcic_hcicmds.cc +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Copyright 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Generated mock file from original source file - * Functions generated:77 - */ - -#include <map> -#include <string> - -extern std::map<std::string, int> mock_function_count_map; -#define UNUSED_ATTR - -#include <stddef.h> -#include <string.h> -#include "bt_common.h" -#include "bt_target.h" -#include "btu.h" -#include "hcidefs.h" -#include "hcimsgs.h" -#include "stack/include/acl_hci_link_interface.h" -void btsnd_hcic_accept_conn(const RawAddress& dest, uint8_t role) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_accept_esco_conn(const RawAddress& bd_addr, - uint32_t transmit_bandwidth, - uint32_t receive_bandwidth, - uint16_t max_latency, uint16_t content_fmt, - uint8_t retrans_effort, - uint16_t packet_types) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_add_SCO_conn(uint16_t handle, uint16_t packet_types) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_auth_request(uint16_t handle) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_change_conn_type(uint16_t handle, uint16_t packet_types) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_change_name(BD_NAME name) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_create_conn(const RawAddress& dest, uint16_t packet_types, - uint8_t page_scan_rep_mode, uint8_t page_scan_mode, - uint16_t clock_offset, uint8_t allow_switch) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_create_conn_cancel(const RawAddress& dest) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_delete_stored_key(const RawAddress& bd_addr, - bool delete_all_flag) { - mock_function_count_map[__func__]++; -} -static void btsnd_hcic_disconnect(uint16_t handle, uint8_t reason) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_enable_test_mode(void) { mock_function_count_map[__func__]++; } -void btsnd_hcic_enhanced_accept_synchronous_connection( - const RawAddress& bd_addr, enh_esco_params_t* p_params) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_enhanced_flush(uint16_t handle, uint8_t packet_type) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_enhanced_set_up_synchronous_connection( - uint16_t conn_handle, enh_esco_params_t* p_params) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_exit_park_mode(uint16_t handle) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_exit_per_inq(void) { mock_function_count_map[__func__]++; } -void btsnd_hcic_exit_sniff_mode(uint16_t handle) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_get_link_quality(uint16_t handle) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_hold_mode(uint16_t handle, uint16_t max_hold_period, - uint16_t min_hold_period) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_host_num_xmitted_pkts(uint8_t num_handles, uint16_t* handle, - uint16_t* num_pkts) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_inq_cancel(void) { mock_function_count_map[__func__]++; } -void btsnd_hcic_inquiry(const LAP inq_lap, uint8_t duration, - uint8_t response_cnt) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_io_cap_req_neg_reply(const RawAddress& bd_addr, - uint8_t err_code) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_io_cap_req_reply(const RawAddress& bd_addr, uint8_t capability, - uint8_t oob_present, uint8_t auth_req) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_link_key_neg_reply(const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_link_key_req_reply(const RawAddress& bd_addr, - const LinkKey& link_key) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_park_mode(uint16_t handle, uint16_t beacon_max_interval, - uint16_t beacon_min_interval) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_per_inq_mode(uint16_t max_period, uint16_t min_period, - const LAP inq_lap, uint8_t duration, - uint8_t response_cnt) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_pin_code_neg_reply(const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_pin_code_req_reply(const RawAddress& bd_addr, - uint8_t pin_code_len, PIN_CODE pin_code) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_qos_setup(uint16_t handle, uint8_t flags, uint8_t service_type, - uint32_t token_rate, uint32_t peak, uint32_t latency, - uint32_t delay_var) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_read_automatic_flush_timeout(uint16_t handle) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_read_encryption_key_size(uint16_t handle, ReadEncKeySizeCb cb) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_read_failed_contact_counter(uint16_t handle) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_read_inq_tx_power(void) { mock_function_count_map[__func__]++; } -void btsnd_hcic_read_lmp_handle(uint16_t handle) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_read_local_oob_data(void) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_read_name(void) { mock_function_count_map[__func__]++; } -void btsnd_hcic_read_rmt_clk_offset(uint16_t handle) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_read_rssi(uint16_t handle) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_read_tx_power(uint16_t handle, uint8_t type) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_reject_conn(const RawAddress& dest, uint8_t reason) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_reject_esco_conn(const RawAddress& bd_addr, uint8_t reason) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_rem_oob_neg_reply(const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_rem_oob_reply(const RawAddress& bd_addr, const Octet16& c, - const Octet16& r) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_rmt_ext_features(uint16_t handle, uint8_t page_num) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_rmt_features_req(uint16_t handle) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_rmt_name_req(const RawAddress& bd_addr, - uint8_t page_scan_rep_mode, uint8_t page_scan_mode, - uint16_t clock_offset) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_rmt_name_req_cancel(const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_rmt_ver_req(uint16_t handle) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_send_keypress_notif(const RawAddress& bd_addr, uint8_t notif) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_set_conn_encrypt(uint16_t handle, bool enable) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_set_event_filter(uint8_t filt_type, uint8_t filt_cond_type, - uint8_t* filt_cond, uint8_t filt_cond_len) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_setup_esco_conn(uint16_t handle, uint32_t transmit_bandwidth, - uint32_t receive_bandwidth, - uint16_t max_latency, uint16_t voice, - uint8_t retrans_effort, uint16_t packet_types) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_sniff_mode(uint16_t handle, uint16_t max_sniff_period, - uint16_t min_sniff_period, uint16_t sniff_attempt, - uint16_t sniff_timeout) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_sniff_sub_rate(uint16_t handle, uint16_t max_lat, - uint16_t min_remote_lat, - uint16_t min_local_lat) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_switch_role(const RawAddress& bd_addr, uint8_t role) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_user_conf_reply(const RawAddress& bd_addr, bool is_yes) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_user_passkey_neg_reply(const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_user_passkey_reply(const RawAddress& bd_addr, uint32_t value) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_vendor_spec_cmd(void* buffer, uint16_t opcode, uint8_t len, - uint8_t* p_data, void* p_cmd_cplt_cback) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_write_auth_enable(uint8_t flag) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_write_auto_flush_tout(uint16_t handle, uint16_t tout) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_write_cur_iac_lap(uint8_t num_cur_iac, LAP* const iac_lap) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_write_def_policy_set(uint16_t settings) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_write_dev_class(DEV_CLASS dev_class) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_write_ext_inquiry_response(void* buffer, uint8_t fec_req) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_write_inqscan_cfg(uint16_t interval, uint16_t window) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_write_inqscan_type(uint8_t type) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_write_inquiry_mode(uint8_t mode) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_write_link_super_tout(uint8_t local_controller_id, - uint16_t handle, uint16_t timeout) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_write_page_tout(uint16_t timeout) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_write_pagescan_cfg(uint16_t interval, uint16_t window) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_write_pagescan_type(uint8_t type) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_write_pin_type(uint8_t type) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_write_policy_set(uint16_t handle, uint16_t settings) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_write_scan_enable(uint8_t flag) { - mock_function_count_map[__func__]++; -} -void btsnd_hcic_write_voice_settings(uint16_t flags) { - mock_function_count_map[__func__]++; -} - -bluetooth::legacy::hci::Interface interface_ = { - .Disconnect = btsnd_hcic_disconnect, - .StartRoleSwitch = btsnd_hcic_switch_role, -}; - -const bluetooth::legacy::hci::Interface& -bluetooth::legacy::hci::GetInterface() { - return interface_; -} diff --git a/system/main/test/common/mock_stack_acl.cc b/system/main/test/common/mock_stack_acl.cc deleted file mode 100644 index a133aff0992..00000000000 --- a/system/main/test/common/mock_stack_acl.cc +++ /dev/null @@ -1,439 +0,0 @@ -/* - * Copyright 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Generated mock file from original source file - * Functions generated:127 - */ - -#include <cstdint> -#include <map> -#include <string> - -extern std::map<std::string, int> mock_function_count_map; - -#include "stack/acl/acl.h" -#include "stack/include/acl_api.h" -#include "stack/include/hci_error_code.h" -#include "types/bt_transport.h" -#include "types/raw_address.h" - -#ifndef UNUSED_ATTR -#define UNUSED_ATTR -#endif - -bool IsEprAvailable(const tACL_CONN& p_acl) { - mock_function_count_map[__func__]++; - return false; -} -bool ACL_SupportTransparentSynchronousData(const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; - return false; -} -bool BTM_BLE_IS_RESOLVE_BDA(const RawAddress& x) { - mock_function_count_map[__func__]++; - return false; -} -bool BTM_IsAclConnectionUp(const RawAddress& remote_bda, - tBT_TRANSPORT transport) { - mock_function_count_map[__func__]++; - return false; -} -bool BTM_IsAclConnectionUpAndHandleValid(const RawAddress& remote_bda, - tBT_TRANSPORT transport) { - mock_function_count_map[__func__]++; - return false; -} -bool BTM_IsAclConnectionUpFromHandle(uint16_t hci_handle) { - mock_function_count_map[__func__]++; - return false; -} -bool BTM_IsBleConnection(uint16_t hci_handle) { - mock_function_count_map[__func__]++; - return false; -} -bool BTM_ReadRemoteConnectionAddr(const RawAddress& pseudo_addr, - RawAddress& conn_addr, - tBLE_ADDR_TYPE* p_addr_type) { - mock_function_count_map[__func__]++; - return false; -} -bool BTM_ReadRemoteVersion(const RawAddress& addr, uint8_t* lmp_version, - uint16_t* manufacturer, uint16_t* lmp_sub_version) { - mock_function_count_map[__func__]++; - return false; -} -bool acl_create_le_connection(const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; - return false; -} -bool acl_create_le_connection_with_id(uint8_t id, const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; - return false; -} -bool acl_is_role_switch_allowed() { - mock_function_count_map[__func__]++; - return false; -} -bool acl_is_switch_role_idle(const RawAddress& bd_addr, - tBT_TRANSPORT transport) { - mock_function_count_map[__func__]++; - return false; -} -bool acl_peer_supports_ble_2m_phy(uint16_t hci_handle) { - mock_function_count_map[__func__]++; - return false; -} -bool acl_peer_supports_ble_coded_phy(uint16_t hci_handle) { - mock_function_count_map[__func__]++; - return false; -} -bool acl_peer_supports_ble_connection_parameters_request( - const RawAddress& remote_bda) { - mock_function_count_map[__func__]++; - return false; -} -bool acl_peer_supports_ble_packet_extension(uint16_t hci_handle) { - mock_function_count_map[__func__]++; - return false; -} -bool acl_peer_supports_sniff_subrating(const RawAddress& remote_bda) { - mock_function_count_map[__func__]++; - return false; -} -bool acl_refresh_remote_address(const RawAddress& identity_address, - tBLE_ADDR_TYPE identity_address_type, - const RawAddress& bda, tBLE_ADDR_TYPE rra_type, - const RawAddress& rpa) { - mock_function_count_map[__func__]++; - return false; -} -bool acl_set_peer_le_features_from_handle(uint16_t hci_handle, - const uint8_t* p) { - mock_function_count_map[__func__]++; - return false; -} -bool sco_peer_supports_esco_2m_phy(const RawAddress& remote_bda) { - mock_function_count_map[__func__]++; - return false; -} -bool sco_peer_supports_esco_3m_phy(const RawAddress& remote_bda) { - mock_function_count_map[__func__]++; - return false; -} -const RawAddress acl_address_from_handle(uint16_t handle) { - mock_function_count_map[__func__]++; - return RawAddress::kEmpty; -} -void acl_send_data_packet_br_edr([[maybe_unused]] const RawAddress& bd_addr, - BT_HDR* p_buf) { - mock_function_count_map[__func__]++; -} -void acl_create_classic_connection(const RawAddress& bd_addr, - bool there_are_high_priority_channels, - bool is_bonding) { - mock_function_count_map[__func__]++; -} -tACL_CONN* acl_get_connection_from_address(const RawAddress& bd_addr, - tBT_TRANSPORT transport) { - mock_function_count_map[__func__]++; - return nullptr; -} -tACL_CONN* acl_get_connection_from_handle(uint16_t handle) { - mock_function_count_map[__func__]++; - return nullptr; -} -tBTM_STATUS BTM_GetLinkSuperTout(const RawAddress& remote_bda, - uint16_t* p_timeout) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS BTM_GetRole(const RawAddress& remote_bd_addr, tHCI_ROLE* p_role) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS BTM_ReadFailedContactCounter(const RawAddress& remote_bda, - tBTM_CMPL_CB* p_cb) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS BTM_ReadRSSI(const RawAddress& remote_bda, tBTM_CMPL_CB* p_cb) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS BTM_ReadTxPower(const RawAddress& remote_bda, - tBT_TRANSPORT transport, tBTM_CMPL_CB* p_cb) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS BTM_SetLinkSuperTout(const RawAddress& remote_bda, - uint16_t timeout) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS BTM_SwitchRoleToCentral(const RawAddress& remote_bd_addr) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS btm_remove_acl(const RawAddress& bd_addr, tBT_TRANSPORT transport) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -uint16_t BTM_GetHCIConnHandle(const RawAddress& remote_bda, - tBT_TRANSPORT transport) { - mock_function_count_map[__func__]++; - return 0; -} -uint16_t BTM_GetMaxPacketSize(const RawAddress& addr) { - mock_function_count_map[__func__]++; - return 0; -} -uint16_t mock_stack_acl_num_links = 0; -uint16_t BTM_GetNumAclLinks(void) { - mock_function_count_map[__func__]++; - return mock_stack_acl_num_links; -} -uint16_t acl_get_supported_packet_types() { - mock_function_count_map[__func__]++; - return 0; -} -tHCI_REASON btm_get_acl_disc_reason_code(void) { - mock_function_count_map[__func__]++; - return HCI_SUCCESS; -} -uint8_t BTM_SetTraceLevel(uint8_t new_level) { - mock_function_count_map[__func__]++; - return 0; -} -uint8_t acl_link_role_from_handle(uint16_t handle) { - mock_function_count_map[__func__]++; - return 0; -} -uint8_t btm_handle_to_acl_index(uint16_t hci_handle) { - mock_function_count_map[__func__]++; - return 0; -} -uint8_t* BTM_ReadRemoteFeatures(const RawAddress& addr) { - mock_function_count_map[__func__]++; - return nullptr; -} -void ACL_RegisterClient(struct acl_client_callback_s* callbacks) { - mock_function_count_map[__func__]++; -} -void ACL_UnregisterClient(struct acl_client_callback_s* callbacks) { - mock_function_count_map[__func__]++; -} -void BTM_ReadConnectionAddr(const RawAddress& remote_bda, - RawAddress& local_conn_addr, - tBLE_ADDR_TYPE* p_addr_type) { - mock_function_count_map[__func__]++; -} -void BTM_acl_after_controller_started(const controller_t* controller) { - mock_function_count_map[__func__]++; -} -void BTM_block_role_switch_for(const RawAddress& peer_addr) { - mock_function_count_map[__func__]++; -} -void BTM_block_sniff_mode_for(const RawAddress& peer_addr) { - mock_function_count_map[__func__]++; -} -void BTM_default_block_role_switch() { mock_function_count_map[__func__]++; } -void BTM_default_unblock_role_switch() { mock_function_count_map[__func__]++; } -void BTM_unblock_role_switch_for(const RawAddress& peer_addr) { - mock_function_count_map[__func__]++; -} -void BTM_unblock_sniff_mode_for(const RawAddress& peer_addr) { - mock_function_count_map[__func__]++; -} -void acl_accept_connection_request(const RawAddress& bd_addr, uint8_t role) { - mock_function_count_map[__func__]++; -} -void acl_disconnect_after_role_switch(uint16_t conn_handle, - tHCI_STATUS reason) { - mock_function_count_map[__func__]++; -} -void acl_disconnect_from_handle(uint16_t handle, tHCI_STATUS reason) { - mock_function_count_map[__func__]++; -} -void acl_link_segments_xmitted(BT_HDR* p_msg) { - mock_function_count_map[__func__]++; -} -void acl_packets_completed(uint16_t handle, uint16_t credits) { - mock_function_count_map[__func__]++; -} -void acl_process_supported_features(uint16_t handle, uint64_t features) { - mock_function_count_map[__func__]++; -} -void acl_process_extended_features(uint16_t handle, uint8_t current_page_number, - uint8_t max_page_number, uint64_t features) { - mock_function_count_map[__func__]++; -} -void acl_process_num_completed_pkts(uint8_t* p, uint8_t evt_len) { - mock_function_count_map[__func__]++; -} -void acl_rcv_acl_data(BT_HDR* p_msg) { mock_function_count_map[__func__]++; } -void acl_reject_connection_request(const RawAddress& bd_addr, uint8_t reason) { - mock_function_count_map[__func__]++; -} -void acl_send_data_packet_ble(const RawAddress& bd_addr, BT_HDR* p_buf) { - mock_function_count_map[__func__]++; -} -void acl_set_disconnect_reason(tHCI_STATUS acl_disc_reason) { - mock_function_count_map[__func__]++; -} -void acl_write_automatic_flush_timeout(const RawAddress& bd_addr, - uint16_t flush_timeout_in_ticks) { - mock_function_count_map[__func__]++; -} -void btm_acl_connected(const RawAddress& bda, uint16_t handle, - tHCI_STATUS status, uint8_t enc_mode) { - mock_function_count_map[__func__]++; -} -void btm_acl_connection_request(const RawAddress& bda, uint8_t* dc) { - mock_function_count_map[__func__]++; -} -void btm_acl_created(const RawAddress& bda, uint16_t hci_handle, - tHCI_ROLE link_role, tBT_TRANSPORT transport) { - mock_function_count_map[__func__]++; -} -void btm_acl_device_down(void) { mock_function_count_map[__func__]++; } -void btm_acl_disconnected(tHCI_STATUS status, uint16_t handle, - tHCI_REASON reason) { - mock_function_count_map[__func__]++; -} -void btm_acl_encrypt_change(uint16_t handle, uint8_t status, - uint8_t encr_enable) { - mock_function_count_map[__func__]++; -} -void btm_acl_notif_conn_collision(const RawAddress& bda) { - mock_function_count_map[__func__]++; -} -void btm_acl_paging(BT_HDR* p, const RawAddress& bda) { - mock_function_count_map[__func__]++; -} -void btm_acl_process_sca_cmpl_pkt(uint8_t len, uint8_t* data) { - mock_function_count_map[__func__]++; -} -void btm_acl_removed(uint16_t handle) { mock_function_count_map[__func__]++; } -void btm_acl_reset_paging(void) { mock_function_count_map[__func__]++; } -void btm_acl_resubmit_page(void) { mock_function_count_map[__func__]++; } -void btm_acl_role_changed(tHCI_STATUS hci_status, const RawAddress& bd_addr, - tHCI_ROLE new_role) { - mock_function_count_map[__func__]++; -} -void btm_acl_set_paging(bool value) { mock_function_count_map[__func__]++; } -void btm_acl_update_conn_addr(uint16_t handle, const RawAddress& address) { - mock_function_count_map[__func__]++; -} -void btm_acl_update_inquiry_status(uint8_t status) { - mock_function_count_map[__func__]++; -} -void btm_ble_refresh_local_resolvable_private_addr( - const RawAddress& pseudo_addr, const RawAddress& local_rpa) { - mock_function_count_map[__func__]++; -} -void btm_cont_rswitch_from_handle(uint16_t hci_handle) { - mock_function_count_map[__func__]++; -} -void btm_establish_continue_from_address(const RawAddress& bda, - tBT_TRANSPORT transport) { - mock_function_count_map[__func__]++; -} -void btm_process_remote_ext_features(tACL_CONN* p_acl_cb, - uint8_t max_page_number) { - mock_function_count_map[__func__]++; -} -void btm_process_remote_version_complete(uint8_t status, uint16_t handle, - uint8_t lmp_version, - uint16_t manufacturer, - uint16_t lmp_subversion) { - mock_function_count_map[__func__]++; -} -void btm_read_automatic_flush_timeout_complete(uint8_t* p) { - mock_function_count_map[__func__]++; -} -void btm_read_failed_contact_counter_complete(uint8_t* p) { - mock_function_count_map[__func__]++; -} -void btm_read_failed_contact_counter_timeout(UNUSED_ATTR void* data) { - mock_function_count_map[__func__]++; -} -void btm_read_link_quality_complete(uint8_t* p) { - mock_function_count_map[__func__]++; -} -void btm_read_link_quality_timeout(UNUSED_ATTR void* data) { - mock_function_count_map[__func__]++; -} -void btm_read_remote_ext_features(uint16_t handle, uint8_t page_number) { - mock_function_count_map[__func__]++; -} -void btm_read_remote_ext_features_complete(uint16_t handle, uint8_t page_num, - uint8_t max_page, - uint8_t* features) { - mock_function_count_map[__func__]++; -} -void btm_read_remote_ext_features_complete_raw(uint8_t* p, uint8_t evt_len) { - mock_function_count_map[__func__]++; -} -void btm_read_remote_ext_features_failed(uint8_t status, uint16_t handle) { - mock_function_count_map[__func__]++; -} -void btm_read_remote_features_complete(uint16_t handle, uint8_t* features) { - mock_function_count_map[__func__]++; -} -void btm_read_remote_features_complete_raw(uint8_t* p) { - mock_function_count_map[__func__]++; -} -void btm_read_remote_version_complete(tHCI_STATUS status, uint16_t handle, - uint8_t lmp_version, - uint16_t manufacturer, - uint16_t lmp_subversion) { - mock_function_count_map[__func__]++; -} -void btm_read_remote_version_complete_raw(uint8_t* p) { - mock_function_count_map[__func__]++; -} -void btm_read_rssi_complete(uint8_t* p) { mock_function_count_map[__func__]++; } -void btm_read_rssi_timeout(UNUSED_ATTR void* data) { - mock_function_count_map[__func__]++; -} -void btm_read_tx_power_complete(uint8_t* p, bool is_ble) { - mock_function_count_map[__func__]++; -} -void btm_read_tx_power_timeout(UNUSED_ATTR void* data) { - mock_function_count_map[__func__]++; -} -void btm_rejectlist_role_change_device(const RawAddress& bd_addr, - uint8_t hci_status) { - mock_function_count_map[__func__]++; -} -void btm_set_link_policy(tACL_CONN* conn, tLINK_POLICY policy) { - mock_function_count_map[__func__]++; -} -void btm_set_packet_types_from_address(const RawAddress& bd_addr, - uint16_t pkt_types) { - mock_function_count_map[__func__]++; -} -void hci_btm_set_link_supervision_timeout(tACL_CONN& link, uint16_t timeout) { - mock_function_count_map[__func__]++; -} -void on_acl_br_edr_connected(const RawAddress& bda, uint16_t handle, - uint8_t enc_mode) { - mock_function_count_map[__func__]++; -} -void on_acl_br_edr_failed(const RawAddress& bda, tHCI_STATUS status) { - mock_function_count_map[__func__]++; -} diff --git a/system/main/test/common/mock_stack_btm_ble.cc b/system/main/test/common/mock_stack_btm_ble.cc deleted file mode 100644 index a39c780faac..00000000000 --- a/system/main/test/common/mock_stack_btm_ble.cc +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Generated mock file from original source file - * Functions generated:50 - */ - -#include <base/bind.h> -#include <base/callback.h> -#include <cstdint> -#include <map> -#include <string> - -extern std::map<std::string, int> mock_function_count_map; - -#include "stack/btm/btm_ble_int_types.h" -#include "stack/btm/btm_int_types.h" -#include "stack/btm/security_device_record.h" -#include "stack/include/bt_types.h" -#include "stack/include/btm_api_types.h" -#include "stack/include/btm_ble_api_types.h" -#include "stack/include/l2cdefs.h" -#include "types/raw_address.h" - -#ifndef UNUSED_ATTR -#define UNUSED_ATTR -#endif - -void btm_ble_reset_id(void) { mock_function_count_map[__func__]++; } -bool BTM_BleDataSignature(const RawAddress& bd_addr, uint8_t* p_text, - uint16_t len, BLE_SIGNATURE signature) { - mock_function_count_map[__func__]++; - return false; -} -bool BTM_BleVerifySignature(const RawAddress& bd_addr, uint8_t* p_orig, - uint16_t len, uint32_t counter, uint8_t* p_comp) { - mock_function_count_map[__func__]++; - return false; -} -bool BTM_ReadConnectedTransportAddress(RawAddress* remote_bda, - tBT_TRANSPORT transport) { - mock_function_count_map[__func__]++; - return false; -} -bool BTM_UseLeLink(const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; - return false; -} -bool btm_ble_get_acl_remote_addr(uint16_t hci_handle, RawAddress& conn_addr, - tBLE_ADDR_TYPE* p_addr_type) { - mock_function_count_map[__func__]++; - return false; -} -bool btm_ble_get_enc_key_type(const RawAddress& bd_addr, uint8_t* p_key_types) { - mock_function_count_map[__func__]++; - return false; -} -bool btm_get_local_div(const RawAddress& bd_addr, uint16_t* p_div) { - mock_function_count_map[__func__]++; - return false; -} -namespace { -Octet16 octet16; -} - -const Octet16& BTM_GetDeviceDHK() { - mock_function_count_map[__func__]++; - return octet16; -} -const Octet16& BTM_GetDeviceEncRoot() { - mock_function_count_map[__func__]++; - return octet16; -} -const Octet16& BTM_GetDeviceIDRoot() { - mock_function_count_map[__func__]++; - return octet16; -} -tBTM_SEC_ACTION btm_ble_determine_security_act(bool is_originator, - const RawAddress& bdaddr, - uint16_t security_required) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS BTM_SetBleDataLength(const RawAddress& bd_addr, - uint16_t tx_pdu_length) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS btm_ble_set_encryption(const RawAddress& bd_addr, - tBTM_BLE_SEC_ACT sec_act, - uint8_t link_role) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS btm_ble_start_encrypt(const RawAddress& bda, bool use_stk, - Octet16* p_stk) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tL2CAP_LE_RESULT_CODE btm_ble_start_sec_check(const RawAddress& bd_addr, - uint16_t psm, bool is_originator, - tBTM_SEC_CALLBACK* p_callback, - void* p_ref_data) { - mock_function_count_map[__func__]++; - return L2CAP_LE_RESULT_CONN_OK; -} -uint8_t btm_ble_br_keys_req(tBTM_SEC_DEV_REC* p_dev_rec, - tBTM_LE_IO_REQ* p_data) { - mock_function_count_map[__func__]++; - return 0; -} -uint8_t btm_ble_io_capabilities_req(tBTM_SEC_DEV_REC* p_dev_rec, - tBTM_LE_IO_REQ* p_data) { - mock_function_count_map[__func__]++; - return 0; -} -uint8_t btm_ble_read_sec_key_size(const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; - return 0; -} -tSMP_STATUS btm_proc_smp_cback(tSMP_EVT event, const RawAddress& bd_addr, - tSMP_EVT_DATA* p_data) { - mock_function_count_map[__func__]++; - return SMP_SUCCESS; -} -void BTM_BleConfirmReply(const RawAddress& bd_addr, uint8_t res) { - mock_function_count_map[__func__]++; -} -void BTM_BleLoadLocalKeys(uint8_t key_type, tBTM_BLE_LOCAL_KEYS* p_key) { - mock_function_count_map[__func__]++; -} -void BTM_BleOobDataReply(const RawAddress& bd_addr, uint8_t res, uint8_t len, - uint8_t* p_data) { - mock_function_count_map[__func__]++; -} -void BTM_BlePasskeyReply(const RawAddress& bd_addr, uint8_t res, - uint32_t passkey) { - mock_function_count_map[__func__]++; -} -void BTM_BleReadPhy( - const RawAddress& bd_addr, - base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)> cb) { - mock_function_count_map[__func__]++; -} -void BTM_BleReceiverTest(uint8_t rx_freq, tBTM_CMPL_CB* p_cmd_cmpl_cback) { - mock_function_count_map[__func__]++; -} -void BTM_BleSecureConnectionOobDataReply(const RawAddress& bd_addr, - uint8_t* p_c, uint8_t* p_r) { - mock_function_count_map[__func__]++; -} -void BTM_BleSetPhy(const RawAddress& bd_addr, uint8_t tx_phys, uint8_t rx_phys, - uint16_t phy_options) { - mock_function_count_map[__func__]++; -} -void BTM_BleSetPrefConnParams(const RawAddress& bd_addr, uint16_t min_conn_int, - uint16_t max_conn_int, - uint16_t peripheral_latency, - uint16_t supervision_tout) { - mock_function_count_map[__func__]++; -} -void BTM_BleTestEnd(tBTM_CMPL_CB* p_cmd_cmpl_cback) { - mock_function_count_map[__func__]++; -} -void BTM_BleTransmitterTest(uint8_t tx_freq, uint8_t test_data_len, - uint8_t packet_payload, - tBTM_CMPL_CB* p_cmd_cmpl_cback) { - mock_function_count_map[__func__]++; -} -void BTM_ReadDevInfo(const RawAddress& remote_bda, tBT_DEVICE_TYPE* p_dev_type, - tBLE_ADDR_TYPE* p_addr_type) { - mock_function_count_map[__func__]++; -} -void BTM_SecAddBleDevice(const RawAddress& bd_addr, tBT_DEVICE_TYPE dev_type, - tBLE_ADDR_TYPE addr_type) { - mock_function_count_map[__func__]++; -} -void BTM_SecAddBleKey(const RawAddress& bd_addr, tBTM_LE_KEY_VALUE* p_le_key, - tBTM_LE_KEY_TYPE key_type) { - mock_function_count_map[__func__]++; -} -void BTM_SecurityGrant(const RawAddress& bd_addr, uint8_t res) { - mock_function_count_map[__func__]++; -} -void btm_ble_connected(const RawAddress& bda, uint16_t handle, uint8_t enc_mode, - uint8_t role, tBLE_ADDR_TYPE addr_type, - bool addr_matched) { - mock_function_count_map[__func__]++; -} -void btm_ble_connected_from_address_with_type( - const tBLE_BD_ADDR& address_with_type, uint16_t handle, uint8_t enc_mode, - uint8_t role, bool addr_matched) { - mock_function_count_map[__func__]++; -} -void btm_ble_increment_sign_ctr(const RawAddress& bd_addr, bool is_local) { - mock_function_count_map[__func__]++; -} -void btm_ble_link_encrypted(const RawAddress& bd_addr, uint8_t encr_enable) { - mock_function_count_map[__func__]++; -} -void btm_ble_link_sec_check(const RawAddress& bd_addr, - tBTM_LE_AUTH_REQ auth_req, - tBTM_BLE_SEC_REQ_ACT* p_sec_req_act) { - mock_function_count_map[__func__]++; -} -void btm_ble_ltk_request(uint16_t handle, uint8_t rand[8], uint16_t ediv) { - mock_function_count_map[__func__]++; -} -void btm_ble_ltk_request_reply(const RawAddress& bda, bool use_stk, - const Octet16& stk) { - mock_function_count_map[__func__]++; -} -void btm_ble_rand_enc_complete(uint8_t* p, uint16_t op_code, - tBTM_RAND_ENC_CB* p_enc_cplt_cback) { - mock_function_count_map[__func__]++; -} -void btm_ble_set_random_address(const RawAddress& random_bda) { - mock_function_count_map[__func__]++; -} -void btm_ble_test_command_complete(uint8_t* p) { - mock_function_count_map[__func__]++; -} -void btm_ble_update_sec_key_size(const RawAddress& bd_addr, - uint8_t enc_key_size) { - mock_function_count_map[__func__]++; -} -void btm_sec_save_le_key(const RawAddress& bd_addr, tBTM_LE_KEY_TYPE key_type, - tBTM_LE_KEY_VALUE* p_keys, bool pass_to_application) { - mock_function_count_map[__func__]++; -} -void doNothing(uint8_t* data, uint16_t len) { - mock_function_count_map[__func__]++; -} -void read_phy_cb( - base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)> cb, - uint8_t* data, uint16_t len) { - mock_function_count_map[__func__]++; -} diff --git a/system/main/test/common/mock_stack_btm_sco.cc b/system/main/test/common/mock_stack_btm_sco.cc deleted file mode 100644 index 1542c5d9b29..00000000000 --- a/system/main/test/common/mock_stack_btm_sco.cc +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Generated mock file from original source file - * Functions generated:23 - */ - -#include <cstdint> -#include <map> -#include <string> - -extern std::map<std::string, int> mock_function_count_map; - -#include "stack/include/btm_api_types.h" -#include "stack/include/btm_status.h" -#include "stack/include/hci_error_code.h" -#include "types/class_of_device.h" -#include "types/raw_address.h" - -#ifndef UNUSED_ATTR -#define UNUSED_ATTR -#endif - -bool BTM_IsScoActiveByBdaddr(const RawAddress& remote_bda) { - mock_function_count_map[__func__]++; - return false; -} -bool btm_is_sco_active(uint16_t handle) { - mock_function_count_map[__func__]++; - return false; -} -bool btm_sco_removed(uint16_t hci_handle, tHCI_REASON reason) { - mock_function_count_map[__func__]++; - return false; -} -const RawAddress* BTM_ReadScoBdAddr(uint16_t sco_inx) { - mock_function_count_map[__func__]++; - return nullptr; -} -tBTM_STATUS BTM_ChangeEScoLinkParms(uint16_t sco_inx, - tBTM_CHG_ESCO_PARAMS* p_parms) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS BTM_CreateSco(const RawAddress* remote_bda, bool is_orig, - uint16_t pkt_types, uint16_t* p_sco_inx, - tBTM_SCO_CB* p_conn_cb, tBTM_SCO_CB* p_disc_cb) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS BTM_RegForEScoEvts(uint16_t sco_inx, - tBTM_ESCO_CBACK* p_esco_cback) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS BTM_RemoveSco(uint16_t sco_inx) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -tBTM_STATUS BTM_SetEScoMode(enh_esco_params_t* p_parms) { - mock_function_count_map[__func__]++; - return BTM_SUCCESS; -} -uint8_t BTM_GetNumScoLinks(void) { - mock_function_count_map[__func__]++; - return 0; -} -void BTM_EScoConnRsp(uint16_t sco_inx, uint8_t hci_status, - enh_esco_params_t* p_parms) { - mock_function_count_map[__func__]++; -} -void BTM_RemoveSco(const RawAddress& bda) { - mock_function_count_map[__func__]++; -} -void btm_esco_proc_conn_chg(uint8_t status, uint16_t handle, - uint8_t tx_interval, uint8_t retrans_window, - uint16_t rx_pkt_len, uint16_t tx_pkt_len) { - mock_function_count_map[__func__]++; -} -void btm_route_sco_data(BT_HDR* p_msg) { mock_function_count_map[__func__]++; } -void btm_sco_acl_removed(const RawAddress* bda) { - mock_function_count_map[__func__]++; -} -void btm_sco_chk_pend_rolechange(uint16_t hci_handle) { - mock_function_count_map[__func__]++; -} -void btm_sco_chk_pend_unpark(tHCI_STATUS hci_status, uint16_t hci_handle) { - mock_function_count_map[__func__]++; -} -void btm_sco_conn_req(const RawAddress& bda, const DEV_CLASS& dev_class, - uint8_t link_type) { - mock_function_count_map[__func__]++; -} -void btm_sco_connected(tHCI_STATUS hci_status, const RawAddress& bda, - uint16_t hci_handle, tBTM_ESCO_DATA* p_esco_data) { - mock_function_count_map[__func__]++; -} -void btm_sco_disc_chk_pend_for_modechange(uint16_t hci_handle) { - mock_function_count_map[__func__]++; -} -void btm_sco_on_esco_connect_request( - const RawAddress& bda, const bluetooth::types::ClassOfDevice& cod) { - mock_function_count_map[__func__]++; -} -void btm_sco_on_sco_connect_request( - const RawAddress& bda, const bluetooth::types::ClassOfDevice& cod) { - mock_function_count_map[__func__]++; -} -void btm_sco_on_disconnected(uint16_t hci_handle, tHCI_REASON reason) { - mock_function_count_map[__func__]++; -} diff --git a/system/main/test/main_shim_test.cc b/system/main/test/main_shim_test.cc index 4c230c97e86..f02d744119a 100644 --- a/system/main/test/main_shim_test.cc +++ b/system/main/test/main_shim_test.cc @@ -45,13 +45,13 @@ #include "main/shim/acl.h" #include "main/shim/acl_legacy_interface.h" #include "main/shim/helpers.h" -#include "main/test/common/main_handler.h" -#include "main/test/common/mock_entry.h" #include "os/handler.h" #include "os/thread.h" #include "stack/btm/btm_int_types.h" #include "stack/include/btu.h" #include "stack/l2cap/l2c_int.h" +#include "test/common/main_handler.h" +#include "test/mock/mock_main_shim_entry.h" using namespace bluetooth; using namespace testing; diff --git a/system/stack/Android.bp b/system/stack/Android.bp index 4c2adcf6951..8677c2a338a 100644 --- a/system/stack/Android.bp +++ b/system/stack/Android.bp @@ -690,6 +690,7 @@ cc_test { srcs: crypto_toolbox_srcs + [ ":TestMockDevice", ":TestMockLegacyHciCommands", + ":TestStackL2cap", "acl/acl.cc", "acl/ble_acl.cc", "acl/btm_acl.cc", @@ -728,10 +729,6 @@ cc_test { "test/common/mock_gatt_gatt_auth.cc", "test/common/mock_gatt_main.cc", "test/common/mock_hci_packet_parser.cc", - "test/common/mock_l2cap_l2c_api.cc", - "test/common/mock_l2cap_l2c_ble.cc", - "test/common/mock_l2cap_l2c_link.cc", - "test/common/mock_l2cap_l2c_main.cc", "test/common/mock_l2cap_l2c_utils.cc", "test/common/mock_main_bte_main.cc", "test/common/mock_main_shim.cc", diff --git a/system/stack/test/common/mock_l2cap_l2c_api.cc b/system/stack/test/common/mock_l2cap_l2c_api.cc deleted file mode 100644 index 8f8326dc961..00000000000 --- a/system/stack/test/common/mock_l2cap_l2c_api.cc +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Generated mock file from original source file - * Functions generated:33 - */ - -#include <map> -#include <string> - -extern std::map<std::string, int> mock_function_count_map; - -#include <cstdint> -#include "stack/include/l2c_api.h" -#include "types/raw_address.h" - -#ifndef UNUSED_ATTR -#define UNUSED_ATTR -#endif - -bool L2CA_ConnectCreditBasedRsp(const RawAddress& p_bd_addr, uint8_t id, - std::vector<uint16_t>& accepted_lcids, - uint16_t result, tL2CAP_LE_CFG_INFO* p_cfg) { - mock_function_count_map[__func__]++; - return false; -} -bool L2CA_ConnectFixedChnl(uint16_t fixed_cid, const RawAddress& rem_bda) { - mock_function_count_map[__func__]++; - return false; -} -bool L2CA_DisconnectLECocReq(uint16_t cid) { - mock_function_count_map[__func__]++; - return false; -} -bool L2CA_DisconnectReq(uint16_t cid) { - mock_function_count_map[__func__]++; - return false; -} -bool L2CA_GetPeerFeatures(const RawAddress& bd_addr, uint32_t* p_ext_feat, - uint8_t* p_chnl_mask) { - mock_function_count_map[__func__]++; - return false; -} -bool L2CA_GetPeerLECocConfig(uint16_t lcid, tL2CAP_LE_CFG_INFO* peer_cfg) { - mock_function_count_map[__func__]++; - return false; -} -bool L2CA_GetRemoteCid(uint16_t lcid, uint16_t* rcid) { - mock_function_count_map[__func__]++; - return false; -} -bool L2CA_IsLinkEstablished(const RawAddress& bd_addr, - tBT_TRANSPORT transport) { - mock_function_count_map[__func__]++; - return false; -} -bool L2CA_ReconfigCreditBasedConnsReq(const RawAddress& bda, - std::vector<uint16_t>& lcids, - tL2CAP_LE_CFG_INFO* p_cfg) { - mock_function_count_map[__func__]++; - return false; -} -bool L2CA_RegisterFixedChannel(uint16_t fixed_cid, - tL2CAP_FIXED_CHNL_REG* p_freg) { - mock_function_count_map[__func__]++; - return false; -} -bool L2CA_RemoveFixedChnl(uint16_t fixed_cid, const RawAddress& rem_bda) { - mock_function_count_map[__func__]++; - return false; -} -bool L2CA_SetAclPriority(const RawAddress& bd_addr, tL2CAP_PRIORITY priority) { - mock_function_count_map[__func__]++; - return false; -} -bool L2CA_SetChnlFlushability(uint16_t cid, bool is_flushable) { - mock_function_count_map[__func__]++; - return false; -} -bool L2CA_SetLeGattTimeout(const RawAddress& rem_bda, uint16_t idle_tout) { - mock_function_count_map[__func__]++; - return false; -} -bool L2CA_SetIdleTimeoutByBdAddr(const RawAddress& bd_addr, uint16_t timeout, - tBT_TRANSPORT transport) { - mock_function_count_map[__func__]++; - return false; -} -bool L2CA_SetTxPriority(uint16_t cid, tL2CAP_CHNL_PRIORITY priority) { - mock_function_count_map[__func__]++; - return false; -} -std::vector<uint16_t> L2CA_ConnectCreditBasedReq(uint16_t psm, - const RawAddress& p_bd_addr, - tL2CAP_LE_CFG_INFO* p_cfg) { - mock_function_count_map[__func__]++; - std::vector<uint16_t> v; - return v; -} -tBT_TRANSPORT l2c_get_transport_from_fixed_cid(uint16_t fixed_cid) { - mock_function_count_map[__func__]++; - return 0; -} -uint16_t L2CA_AllocateLePSM(void) { - mock_function_count_map[__func__]++; - return 0; -} -uint16_t L2CA_ConnectLECocReq(uint16_t psm, const RawAddress& p_bd_addr, - tL2CAP_LE_CFG_INFO* p_cfg, uint16_t sec_level) { - mock_function_count_map[__func__]++; - return 0; -} -uint16_t L2CA_ConnectReq(uint16_t psm, const RawAddress& p_bd_addr) { - mock_function_count_map[__func__]++; - return 0; -} -uint16_t L2CA_ConnectReq2(uint16_t psm, const RawAddress& p_bd_addr, - uint16_t sec_level) { - mock_function_count_map[__func__]++; - return 0; -} -uint16_t L2CA_FlushChannel(uint16_t lcid, uint16_t num_to_flush) { - mock_function_count_map[__func__]++; - return 0; -} -uint16_t L2CA_Register(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info, - bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info, - uint16_t my_mtu, uint16_t required_remote_mtu) { - mock_function_count_map[__func__]++; - return 0; -} -uint16_t L2CA_Register2(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info, - bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info, - uint16_t my_mtu, uint16_t required_remote_mtu, - uint16_t sec_level) { - mock_function_count_map[__func__]++; - return 0; -} -uint16_t L2CA_RegisterLECoc(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info, - uint16_t sec_level, tL2CAP_LE_CFG_INFO cfg) { - mock_function_count_map[__func__]++; - return 0; -} -uint16_t L2CA_SendFixedChnlData(uint16_t fixed_cid, const RawAddress& rem_bda, - BT_HDR* p_buf) { - mock_function_count_map[__func__]++; - return 0; -} -uint8_t L2CA_DataWrite(uint16_t cid, BT_HDR* p_data) { - mock_function_count_map[__func__]++; - return 0; -} -uint8_t L2CA_LECocDataWrite(uint16_t cid, BT_HDR* p_data) { - mock_function_count_map[__func__]++; - return 0; -} -uint8_t L2CA_SetTraceLevel(uint8_t new_level) { - mock_function_count_map[__func__]++; - return 0; -} -void L2CA_Deregister(uint16_t psm) { mock_function_count_map[__func__]++; } -void L2CA_DeregisterLECoc(uint16_t psm) { mock_function_count_map[__func__]++; } -void L2CA_FreeLePSM(uint16_t psm) { mock_function_count_map[__func__]++; } diff --git a/system/stack/test/common/mock_l2cap_l2c_ble.cc b/system/stack/test/common/mock_l2cap_l2c_ble.cc deleted file mode 100644 index 44ae6e21886..00000000000 --- a/system/stack/test/common/mock_l2cap_l2c_ble.cc +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Generated mock file from original source file - * Functions generated:26 - */ - -#include <map> -#include <string> - -extern std::map<std::string, int> mock_function_count_map; - -#include <base/logging.h> -#include "bt_target.h" -#include "device/include/controller.h" -#include "hcimsgs.h" -#include "main/shim/shim.h" -#include "osi/include/log.h" -#include "osi/include/osi.h" -#include "stack/btm/btm_dev.h" -#include "stack/btm/btm_sec.h" -#include "stack/include/acl_api.h" -#include "stack/include/l2c_api.h" -#include "stack/include/l2cdefs.h" -#include "stack/l2cap/l2c_int.h" -#include "stack_config.h" - -#ifndef UNUSED_ATTR -#define UNUSED_ATTR -#endif - -bool L2CA_EnableUpdateBleConnParams(const RawAddress& rem_bda, bool enable) { - mock_function_count_map[__func__]++; - return false; -} -bool L2CA_UpdateBleConnParams(const RawAddress& rem_bda, uint16_t min_int, - uint16_t max_int, uint16_t latency, - uint16_t timeout) { - mock_function_count_map[__func__]++; - return false; -} -bool L2CA_UpdateBleConnParams(const RawAddress& rem_bda, uint16_t min_int, - uint16_t max_int, uint16_t latency, - uint16_t timeout, uint16_t min_ce_len, - uint16_t max_ce_len) { - mock_function_count_map[__func__]++; - return false; -} -bool l2cble_conn_comp(uint16_t handle, uint8_t role, const RawAddress& bda, - tBLE_ADDR_TYPE type, uint16_t conn_interval, - uint16_t conn_latency, uint16_t conn_timeout) { - mock_function_count_map[__func__]++; - return false; -} -bool l2cble_conn_comp_from_address_with_type( - uint16_t handle, uint8_t role, const tBLE_BD_ADDR& address_with_type, - uint16_t conn_interval, uint16_t conn_latency, uint16_t conn_timeout) { - mock_function_count_map[__func__]++; - return false; -} -bool l2cble_create_conn(tL2C_LCB* p_lcb) { - mock_function_count_map[__func__]++; - return false; -} -hci_role_t L2CA_GetBleConnRole(const RawAddress& bd_addr) { - mock_function_count_map[__func__]++; - return HCI_ROLE_CENTRAL; -} -tL2CAP_LE_RESULT_CODE l2ble_sec_access_req(const RawAddress& bd_addr, - uint16_t psm, bool is_originator, - tL2CAP_SEC_CBACK* p_callback, - void* p_ref_data) { - mock_function_count_map[__func__]++; - return L2CAP_LE_RESULT_CONN_OK; -} -uint16_t L2CA_GetDisconnectReason(const RawAddress& remote_bda, - tBT_TRANSPORT transport) { - mock_function_count_map[__func__]++; - return 0; -} -void L2CA_AdjustConnectionIntervals(uint16_t* min_interval, - uint16_t* max_interval, - uint16_t floor_interval) { - mock_function_count_map[__func__]++; -} -void L2CA_SetLeFixedChannelTxDataLength(const RawAddress& remote_bda, - uint16_t fix_cid, uint16_t tx_mtu) { - mock_function_count_map[__func__]++; -} -void l2c_ble_link_adjust_allocation(void) { - mock_function_count_map[__func__]++; -} -void l2c_link_processs_ble_num_bufs(uint16_t num_lm_ble_bufs) { - mock_function_count_map[__func__]++; -} -void l2cble_credit_based_conn_req(tL2C_CCB* p_ccb) { - mock_function_count_map[__func__]++; -} -void l2cble_credit_based_conn_res(tL2C_CCB* p_ccb, uint16_t result) { - mock_function_count_map[__func__]++; -} -void l2cble_notify_le_connection(const RawAddress& bda) { - mock_function_count_map[__func__]++; -} -void l2cble_process_conn_update_evt(uint16_t handle, uint8_t status, - uint16_t interval, uint16_t latency, - uint16_t timeout) { - mock_function_count_map[__func__]++; -} -void l2cble_process_data_length_change_event(uint16_t handle, - uint16_t tx_data_len, - uint16_t rx_data_len) { - mock_function_count_map[__func__]++; -} -void l2cble_process_sig_cmd(tL2C_LCB* p_lcb, uint8_t* p, uint16_t pkt_len) { - mock_function_count_map[__func__]++; -} -void l2cble_sec_comp(const RawAddress* bda, tBT_TRANSPORT transport, - void* p_ref_data, uint8_t status) { - mock_function_count_map[__func__]++; -} -void l2cble_send_flow_control_credit(tL2C_CCB* p_ccb, uint16_t credit_value) { - mock_function_count_map[__func__]++; -} -void l2cble_send_peer_disc_req(tL2C_CCB* p_ccb) { - mock_function_count_map[__func__]++; -} -void l2cble_set_fixed_channel_tx_data_length(const RawAddress& remote_bda, - uint16_t fix_cid, - uint16_t tx_mtu) { - mock_function_count_map[__func__]++; -} -void l2cble_update_data_length(tL2C_LCB* p_lcb) { - mock_function_count_map[__func__]++; -} -void l2cble_use_preferred_conn_params(const RawAddress& bda) { - mock_function_count_map[__func__]++; -} diff --git a/system/stack/test/common/mock_l2cap_l2c_main.cc b/system/stack/test/common/mock_l2cap_l2c_main.cc deleted file mode 100644 index 6b11dcb4f64..00000000000 --- a/system/stack/test/common/mock_l2cap_l2c_main.cc +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Generated mock file from original source file - * Functions generated:9 - */ - -#include <map> -#include <string> - -extern std::map<std::string, int> mock_function_count_map; - -#include <string.h> -#include "bt_common.h" -#include "bt_target.h" -#include "hci/include/btsnoop.h" -#include "hcimsgs.h" -#include "main/shim/shim.h" -#include "osi/include/log.h" -#include "osi/include/osi.h" -#include "stack/include/l2c_api.h" -#include "stack/include/l2cdefs.h" -#include "stack/l2cap/l2c_int.h" - -#ifndef UNUSED_ATTR -#define UNUSED_ATTR -#endif - -uint8_t l2c_data_write(uint16_t cid, BT_HDR* p_data, uint16_t flags) { - mock_function_count_map[__func__]++; - return 0; -} -void l2c_ccb_timer_timeout(void* data) { mock_function_count_map[__func__]++; } -void l2c_fcrb_ack_timer_timeout(void* data) { - mock_function_count_map[__func__]++; -} -void l2c_free(void) { mock_function_count_map[__func__]++; } -void l2c_init(void) { mock_function_count_map[__func__]++; } -void l2c_lcb_timer_timeout(void* data) { mock_function_count_map[__func__]++; } -void l2c_process_held_packets(bool timed_out) { - mock_function_count_map[__func__]++; -} -void l2c_rcv_acl_data(BT_HDR* p_msg) { mock_function_count_map[__func__]++; } -void l2c_receive_hold_timer_timeout(UNUSED_ATTR void* data) { - mock_function_count_map[__func__]++; -} diff --git a/system/main/test/common/mock_l2cap_l2c_link.cc b/system/stack/test/common/mock_stack_l2cap_link.cc similarity index 100% rename from system/main/test/common/mock_l2cap_l2c_link.cc rename to system/stack/test/common/mock_stack_l2cap_link.cc diff --git a/system/test/Android.bp b/system/test/Android.bp index aef43b25f9e..a391c3ea123 100644 --- a/system/test/Android.bp +++ b/system/test/Android.bp @@ -96,3 +96,25 @@ filegroup { ], } +filegroup { + name: "TestMockMainShimEntry", + srcs: [ + "mock/mock_main_shim_entry.cc", + ], +} + +filegroup { + name: "TestMockBtif", + srcs: [ + "mock/mock_btif*.cc", + ], +} + +filegroup { + name: "TestStackL2cap", + srcs: [ + "mock/mock_stack_l2cap_*.cc", + ], +} + + diff --git a/system/main/test/common/main_handler.cc b/system/test/common/main_handler.cc similarity index 100% rename from system/main/test/common/main_handler.cc rename to system/test/common/main_handler.cc diff --git a/system/main/test/common/main_handler.h b/system/test/common/main_handler.h similarity index 100% rename from system/main/test/common/main_handler.h rename to system/test/common/main_handler.h diff --git a/system/test/mock/mock_bta_hearing_aid.cc b/system/test/mock/mock_bta_hearing_aid.cc index dea63d9ddd2..865a7845452 100644 --- a/system/test/mock/mock_bta_hearing_aid.cc +++ b/system/test/mock/mock_bta_hearing_aid.cc @@ -32,7 +32,6 @@ extern std::map<std::string, int> mock_function_count_map; #include "bta/include/bta_gatt_api.h" #include "bta/include/bta_gatt_queue.h" #include "bta/include/bta_hearing_aid_api.h" -#include "bta_hearing_aid_api.h" #include "device/include/controller.h" #include "embdrv/g722/g722_enc_dec.h" #include "osi/include/log.h" diff --git a/system/test/mock/mock_bta_vc.cc b/system/test/mock/mock_bta_vc.cc index 6ac9f573e18..4a702739fda 100644 --- a/system/test/mock/mock_bta_vc.cc +++ b/system/test/mock/mock_bta_vc.cc @@ -31,11 +31,10 @@ extern std::map<std::string, int> mock_function_count_map; #include <hardware/bt_vc.h> #include <string> #include <vector> -#include "bta/vc/devices.h" -#include "bta_gatt_api.h" -#include "bta_gatt_queue.h" -#include "bta_vc_api.h" -#include "btif_storage.h" +#include "bta/include/bta_gatt_api.h" +#include "bta/include/bta_gatt_queue.h" +#include "bta/include/bta_vc_api.h" +#include "btif/include/btif_storage.h" #ifndef UNUSED_ATTR #define UNUSED_ATTR diff --git a/system/test/mock/mock_bta_vc_device.cc b/system/test/mock/mock_bta_vc_device.cc index d4102463d3f..c2457cc91f9 100644 --- a/system/test/mock/mock_bta_vc_device.cc +++ b/system/test/mock/mock_bta_vc_device.cc @@ -27,9 +27,6 @@ extern std::map<std::string, int> mock_function_count_map; #include <map> #include <vector> #include "bta/vc/devices.h" -#include "bta_gatt_api.h" -#include "bta_gatt_queue.h" -#include "gatt_api.h" #include "stack/btm/btm_sec.h" using namespace bluetooth::vc::internal; diff --git a/system/main/test/common/mock_btif_core.cc b/system/test/mock/mock_btif_core.cc similarity index 100% rename from system/main/test/common/mock_btif_core.cc rename to system/test/mock/mock_btif_core.cc diff --git a/system/main/test/common/mock_btif_dm.cc b/system/test/mock/mock_btif_dm.cc similarity index 100% rename from system/main/test/common/mock_btif_dm.cc rename to system/test/mock/mock_btif_dm.cc diff --git a/system/test/mock/mock_l2cap_main.cc b/system/test/mock/mock_l2cap_main.cc deleted file mode 100644 index 677858e122c..00000000000 --- a/system/test/mock/mock_l2cap_main.cc +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Generated mock file from original source file - * Functions generated:9 - */ - -#include <map> -#include <string> - -extern std::map<std::string, int> mock_function_count_map; - -#include <string.h> -#include "bt_common.h" -#include "bt_target.h" -#include "hci/include/btsnoop.h" -#include "hcimsgs.h" -#include "l2c_api.h" -#include "l2c_int.h" -#include "l2cdefs.h" -#include "main/shim/shim.h" -#include "osi/include/log.h" -#include "osi/include/osi.h" - -#ifndef UNUSED_ATTR -#define UNUSED_ATTR -#endif - -uint8_t l2c_data_write(uint16_t cid, BT_HDR* p_data, uint16_t flags) { - mock_function_count_map[__func__]++; - return 0; -} -void l2c_ccb_timer_timeout(void* data) { mock_function_count_map[__func__]++; } -void l2c_fcrb_ack_timer_timeout(void* data) { - mock_function_count_map[__func__]++; -} -void l2c_free(void) { mock_function_count_map[__func__]++; } -void l2c_init(void) { mock_function_count_map[__func__]++; } -void l2c_lcb_timer_timeout(void* data) { mock_function_count_map[__func__]++; } -void l2c_process_held_packets(bool timed_out) { - mock_function_count_map[__func__]++; -} -void l2c_rcv_acl_data(BT_HDR* p_msg) { mock_function_count_map[__func__]++; } -void l2c_receive_hold_timer_timeout(UNUSED_ATTR void* data) { - mock_function_count_map[__func__]++; -} diff --git a/system/main/test/common/mock_entry.cc b/system/test/mock/mock_main_shim_entry.cc similarity index 93% rename from system/main/test/common/mock_entry.cc rename to system/test/mock/mock_main_shim_entry.cc index 69fdb7a2a7d..594d2ca54ad 100644 --- a/system/main/test/common/mock_entry.cc +++ b/system/test/mock/mock_main_shim_entry.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "gd/btaa/activity_attribution.h" +// #include "gd/btaa/activity_attribution.h" #include "gd/hci/acl_manager_mock.h" #include "gd/hci/controller_mock.h" #include "gd/hci/hci_layer.h" @@ -40,6 +40,7 @@ namespace testing { MockAclManager* mock_acl_manager_{nullptr}; MockController* mock_controller_{nullptr}; +os::Handler* mock_gd_shim_handler_{nullptr}; } // namespace testing } // namespace hci @@ -62,7 +63,7 @@ neighbor::DiscoverabilityModule* GetDiscoverability() { return nullptr; } neighbor::InquiryModule* GetInquiry() { return nullptr; } neighbor::NameModule* GetName() { return nullptr; } neighbor::PageModule* GetPage() { return nullptr; } -os::Handler* GetGdShimHandler() { return Stack::GetInstance()->GetHandler(); } +os::Handler* GetGdShimHandler() { return hci::testing::mock_gd_shim_handler_; } security::SecurityModule* GetSecurityModule() { return nullptr; } storage::StorageModule* GetStorage() { return nullptr; } diff --git a/system/main/test/common/mock_entry.h b/system/test/mock/mock_main_shim_entry.h similarity index 100% rename from system/main/test/common/mock_entry.h rename to system/test/mock/mock_main_shim_entry.h diff --git a/system/test/mock/mock_stack_a2dp_api.cc b/system/test/mock/mock_stack_a2dp_api.cc index 5ca56717af2..db59f9f0fdf 100644 --- a/system/test/mock/mock_stack_a2dp_api.cc +++ b/system/test/mock/mock_stack_a2dp_api.cc @@ -26,12 +26,12 @@ extern std::map<std::string, int> mock_function_count_map; #include <string.h> #include "a2dp_api.h" -#include "a2dp_int.h" #include "avdt_api.h" #include "bt_common.h" #include "bt_target.h" #include "osi/include/log.h" #include "sdpdefs.h" +#include "stack/a2dp/a2dp_int.h" #ifndef UNUSED_ATTR #define UNUSED_ATTR diff --git a/system/main/test/common/mock_acl_ble.cc b/system/test/mock/mock_stack_acl_ble.cc similarity index 100% rename from system/main/test/common/mock_acl_ble.cc rename to system/test/mock/mock_stack_acl_ble.cc diff --git a/system/main/test/common/mock_acl_btm_pm.cc b/system/test/mock/mock_stack_acl_btm_pm.cc similarity index 100% rename from system/main/test/common/mock_acl_btm_pm.cc rename to system/test/mock/mock_stack_acl_btm_pm.cc diff --git a/system/test/mock/mock_stack_avct_api.cc b/system/test/mock/mock_stack_avct_api.cc index 4c20810a6a6..85adf06a57a 100644 --- a/system/test/mock/mock_stack_avct_api.cc +++ b/system/test/mock/mock_stack_avct_api.cc @@ -29,7 +29,6 @@ extern std::map<std::string, int> mock_function_count_map; #include "bt_common.h" #include "bt_target.h" #include "bt_types.h" -#include "bt_utils.h" #include "bta/include/bta_api.h" #include "btm_api.h" #include "l2c_api.h" diff --git a/system/test/mock/mock_stack_avdt_api.cc b/system/test/mock/mock_stack_avdt_api.cc index e3051687cea..a75860146c6 100644 --- a/system/test/mock/mock_stack_avdt_api.cc +++ b/system/test/mock/mock_stack_avdt_api.cc @@ -26,7 +26,6 @@ extern std::map<std::string, int> mock_function_count_map; #include <string.h> #include "avdt_api.h" -#include "avdt_int.h" #include "avdtc_api.h" #include "bt_target.h" #include "bt_types.h" @@ -36,6 +35,7 @@ extern std::map<std::string, int> mock_function_count_map; #include "l2c_api.h" #include "main/shim/dumpsys.h" #include "osi/include/log.h" +#include "stack/avdt/avdt_int.h" #include "stack/btm/btm_sec.h" #include "stack/include/a2dp_codec_api.h" diff --git a/system/test/mock/mock_stack_avrc_bld_tg.cc b/system/test/mock/mock_stack_avrc_bld_tg.cc index 96ebee02591..2189915a7ae 100644 --- a/system/test/mock/mock_stack_avrc_bld_tg.cc +++ b/system/test/mock/mock_stack_avrc_bld_tg.cc @@ -29,7 +29,6 @@ extern std::map<std::string, int> mock_function_count_map; #include "avrc_api.h" #include "avrc_defs.h" #include "bt_common.h" -#include "bt_utils.h" #include "osi/include/osi.h" #include "stack/avrc/avrc_int.h" diff --git a/system/test/mock/mock_stack_avrc_pars.ct.cc b/system/test/mock/mock_stack_avrc_pars.ct.cc index d4d4ee43f8d..b4f88e7c6d1 100644 --- a/system/test/mock/mock_stack_avrc_pars.ct.cc +++ b/system/test/mock/mock_stack_avrc_pars.ct.cc @@ -28,7 +28,6 @@ extern std::map<std::string, int> mock_function_count_map; #include "avrc_api.h" #include "avrc_defs.h" #include "bt_common.h" -#include "bt_utils.h" #include "osi/include/log.h" #include "osi/include/osi.h" #include "stack/avrc/avrc_int.h" diff --git a/system/test/mock/mock_stack_btm.cc b/system/test/mock/mock_stack_btm.cc index 12f62afa490..d1a8b6b4cb3 100644 --- a/system/test/mock/mock_stack_btm.cc +++ b/system/test/mock/mock_stack_btm.cc @@ -22,39 +22,10 @@ #include "stack/include/btm_client_interface.h" #include "types/raw_address.h" -bool BTM_HasEirService(const uint32_t* p_eir_uuid, uint16_t uuid16) { - return false; -} -tBTM_INQ_INFO* BTM_InqDbFirst(void) { return nullptr; } -tBTM_INQ_INFO* BTM_InqDbNext(tBTM_INQ_INFO* p_cur) { return nullptr; } -tBTM_INQ_INFO* BTM_InqDbRead(const RawAddress& p_bda) { return nullptr; } -tBTM_STATUS BTM_CancelRemoteDeviceName(void) { return BTM_SUCCESS; } -tBTM_STATUS BTM_ClearInqDb(const RawAddress* p_bda) { return BTM_SUCCESS; } -tBTM_STATUS BTM_ReadRemoteDeviceName(const RawAddress& remote_bda, - tBTM_CMPL_CB* p_cb, - tBT_TRANSPORT transport) { - return BTM_SUCCESS; -} -tBTM_STATUS BTM_SetConnectability(uint16_t page_mode) { return BTM_SUCCESS; } -tBTM_STATUS BTM_StartInquiry(tBTM_INQ_RESULTS_CB* p_results_cb, - tBTM_CMPL_CB* p_cmpl_cb) { - return BTM_SUCCESS; -} -tBTM_STATUS BTM_WriteEIR(BT_HDR* p_buff) { return BTM_SUCCESS; } -tBTM_STATUS BTM_SetDiscoverability(uint16_t inq_mode) { return BTM_SUCCESS; } tBTM_STATUS BTM_BleGetEnergyInfo(tBTM_BLE_ENERGY_INFO_CBACK* p_ener_cback) { return BTM_SUCCESS; } -uint16_t BTM_IsInquiryActive(void) { return 0; } -uint8_t BTM_GetEirSupportedServices(uint32_t* p_eir_uuid, uint8_t** p, - uint8_t max_num_uuid16, - uint8_t* p_num_uuid16) { - return 0; -} -void BTM_AddEirService(uint32_t* p_eir_uuid, uint16_t uuid16) {} void BTM_BleReadControllerFeatures(tBTM_BLE_CTRL_FEATURES_CBACK* p_vsc_cback) {} -void BTM_CancelInquiry(void) {} -void BTM_RemoveEirService(uint32_t* p_eir_uuid, uint16_t uuid16) {} bool BTM_is_sniff_allowed_for(const RawAddress& peer_addr) { return false; } uint8_t BTM_GetAcceptlistSize() { return 0; } diff --git a/system/test/mock/mock_stack_btm_ble_adv_filter.cc b/system/test/mock/mock_stack_btm_ble_adv_filter.cc index c65dea059a9..b36a894e9e2 100644 --- a/system/test/mock/mock_stack_btm_ble_adv_filter.cc +++ b/system/test/mock/mock_stack_btm_ble_adv_filter.cc @@ -32,7 +32,6 @@ extern std::map<std::string, int> mock_function_count_map; #include "bt_target.h" #include "bt_types.h" #include "btm_ble_api.h" -#include "btm_int.h" #include "btu.h" #include "device/include/controller.h" #include "hcidefs.h" diff --git a/system/test/mock/mock_stack_btm_ble_batchscan.cc b/system/test/mock/mock_stack_btm_ble_batchscan.cc index 143783b02c5..3f5a8803baa 100644 --- a/system/test/mock/mock_stack_btm_ble_batchscan.cc +++ b/system/test/mock/mock_stack_btm_ble_batchscan.cc @@ -32,7 +32,6 @@ extern std::map<std::string, int> mock_function_count_map; #include "bt_target.h" #include "bt_types.h" #include "btm_ble_api.h" -#include "btm_int.h" #include "btu.h" #include "device/include/controller.h" #include "hcimsgs.h" diff --git a/system/test/mock/mock_stack_btm_ble_multi_adv.cc b/system/test/mock/mock_stack_btm_ble_multi_adv.cc index 12664bd6a08..aa8c54fb734 100644 --- a/system/test/mock/mock_stack_btm_ble_multi_adv.cc +++ b/system/test/mock/mock_stack_btm_ble_multi_adv.cc @@ -35,12 +35,12 @@ extern std::map<std::string, int> mock_function_count_map; #include <queue> #include <vector> #include "ble_advertiser.h" -#include "ble_advertiser_hci_interface.h" #include "bt_target.h" -#include "btm_int_types.h" #include "device/include/controller.h" #include "osi/include/alarm.h" +#include "stack/btm/ble_advertiser_hci_interface.h" #include "stack/btm/btm_ble_int.h" +#include "stack/btm/btm_int_types.h" #ifndef UNUSED_ATTR #define UNUSED_ATTR diff --git a/system/test/mock/mock_stack_btm_devctl.cc b/system/test/mock/mock_stack_btm_devctl.cc index e51b253b8c9..ea3d41ad755 100644 --- a/system/test/mock/mock_stack_btm_devctl.cc +++ b/system/test/mock/mock_stack_btm_devctl.cc @@ -33,7 +33,6 @@ extern std::map<std::string, int> mock_function_count_map; #include "bta/sys/bta_sys.h" #include "btcore/include/module.h" #include "btif/include/btif_bqr.h" -#include "btm_int.h" #include "btu.h" #include "common/message_loop_thread.h" #include "device/include/controller.h" diff --git a/system/main/test/common/mock_btm_inq.cc b/system/test/mock/mock_stack_btm_inq.cc similarity index 100% rename from system/main/test/common/mock_btm_inq.cc rename to system/test/mock/mock_stack_btm_inq.cc diff --git a/system/test/mock/mock_stack_gatt_main.cc b/system/test/mock/mock_stack_gatt_main.cc index db36dc9b554..cdc037b446c 100644 --- a/system/test/mock/mock_stack_gatt_main.cc +++ b/system/test/mock/mock_stack_gatt_main.cc @@ -26,12 +26,10 @@ extern std::map<std::string, int> mock_function_count_map; #include "bt_common.h" #include "bt_target.h" -#include "bt_utils.h" -#include "btif_storage.h" -#include "btm_ble_int.h" #include "device/include/interop.h" #include "l2c_api.h" #include "osi/include/osi.h" +#include "stack/btm/btm_ble_int.h" #include "stack/btm/btm_dev.h" #include "stack/btm/btm_sec.h" #include "stack/gatt/gatt_int.h" diff --git a/system/main/test/common/mock_l2cap_l2c_ble.cc b/system/test/mock/mock_stack_l2cap_ble.cc similarity index 100% rename from system/main/test/common/mock_l2cap_l2c_ble.cc rename to system/test/mock/mock_stack_l2cap_ble.cc diff --git a/system/stack/test/common/mock_l2cap_l2c_link.cc b/system/test/mock/mock_stack_l2cap_link.cc similarity index 100% rename from system/stack/test/common/mock_l2cap_l2c_link.cc rename to system/test/mock/mock_stack_l2cap_link.cc diff --git a/system/test/mock/mock_stack_l2cap_main.cc b/system/test/mock/mock_stack_l2cap_main.cc index 677858e122c..ab28a6cd1d3 100644 --- a/system/test/mock/mock_stack_l2cap_main.cc +++ b/system/test/mock/mock_stack_l2cap_main.cc @@ -30,11 +30,11 @@ extern std::map<std::string, int> mock_function_count_map; #include "hci/include/btsnoop.h" #include "hcimsgs.h" #include "l2c_api.h" -#include "l2c_int.h" #include "l2cdefs.h" #include "main/shim/shim.h" #include "osi/include/log.h" #include "osi/include/osi.h" +#include "stack/l2cap/l2c_int.h" #ifndef UNUSED_ATTR #define UNUSED_ATTR diff --git a/system/test/mock/mock_stack_pan_api.cc b/system/test/mock/mock_stack_pan_api.cc index cb452b3347f..29023b2d0d7 100644 --- a/system/test/mock/mock_stack_pan_api.cc +++ b/system/test/mock/mock_stack_pan_api.cc @@ -29,7 +29,6 @@ extern std::map<std::string, int> mock_function_count_map; #include "bnep_api.h" #include "bt_common.h" #include "bt_types.h" -#include "bta_sys.h" #include "btm_api.h" #include "hcidefs.h" #include "l2c_api.h" -- GitLab