Loading system/test/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -287,6 +287,8 @@ filegroup { name: "TestMockBtif", srcs: [ ":TestCommonJniThread", ":TestCommonCoreInterface", ":TestMockBluetoothInterface", "mock/mock_btif*.cc", ], } Loading system/test/common/core_interface.cc +57 −24 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ * limitations under the License. */ #include "core_interface.h" #include "btif/include/btif_common.h" #include "btif/include/core_callbacks.h" #include "btif/include/stack_manager.h" Loading @@ -37,34 +39,49 @@ static bluetooth::core::EventCallbacks eventCallbacks = { .invoke_energy_info_cb = invoke_energy_info_cb, .invoke_link_quality_report_cb = invoke_link_quality_report_cb}; struct MockCoreInterface : bluetooth::core::CoreInterface { void onBluetoothEnabled() override{}; bt_status_t toggleProfile(tBTA_SERVICE_ID service_id, bool enable) override { return BT_STATUS_SUCCESS; }; void removeDeviceFromProfiles(const RawAddress& bd_addr) override{}; void onLinkDown(const RawAddress& bd_addr) override{}; MockCoreInterface() : bluetooth::core::CoreInterface{&eventCallbacks, nullptr, nullptr, nullptr} {}; // This interface lets us query for configuration properties of the stack that // could change at runtime struct MockConfigInterface : public bluetooth::core::ConfigInterface { virtual bool isA2DPOffloadEnabled() { return false; } virtual bool isAndroidTVDevice() { return false; } virtual bool isRestrictedMode() { return false; } }; } // namespace static auto mockConfigInterface = MockConfigInterface{}; // This interface lets us communicate with encoders used in profiles struct MockCodecInterface : public bluetooth::core::CodecInterface { virtual void initialize(){}; virtual void cleanup() {} // HORRIBLE HACKY "MOCK" - the BTIF test target includes bluetooth.cc, so even // btif-"core" tests need this symbol to be available (since the linker doesn't // strip it for some reason) // // TODO(rahularya): remove this once build files are changed in aosp/2258765 bool bta_hh_le_is_hh_gatt_if(tGATT_IF client_if) { // If your test is not testing HID, then this is false and we are all fine. // // If your test *is* testing HID, you should get a linker error since this // symbol had better be available. In which case you will need to figure out // how to fix this properly, or have some macro to conditionally supply this // symbol. Sorry. virtual uint32_t encodePacket(int16_t* input, uint8_t* output) { return 0; }; virtual bool decodePacket(const uint8_t* i_buf, int16_t* o_buf, size_t out_len) { return false; } }; }; static auto mockCodecInterface = MockCodecInterface{}; struct bluetooth::core::HACK_ProfileInterface HACK_profileInterface = { // HID .btif_hh_connect = nullptr, .btif_hh_virtual_unplug = nullptr, .bta_hh_read_ssr_param = nullptr, .bta_hh_le_is_hh_gatt_if = nullptr, .bta_hh_cleanup_disable = nullptr, // AVDTP .btif_av_set_dynamic_audio_buffer_size = nullptr, // ASHA .GetHearingAidDeviceCount = nullptr, // LE Audio .IsLeAudioClientRunning = nullptr, }; } // namespace void InitializeCoreInterface() { static auto mockCoreInterface = MockCoreInterface{}; Loading @@ -74,3 +91,19 @@ void InitializeCoreInterface() { void CleanCoreInterface() { stack_manager_get_interface()->clean_up_stack([] {}); } MockCoreInterface::MockCoreInterface() : bluetooth::core::CoreInterface{&eventCallbacks, &mockConfigInterface, &mockCodecInterface, &HACK_profileInterface} {}; void MockCoreInterface::onBluetoothEnabled(){}; bt_status_t MockCoreInterface::toggleProfile(tBTA_SERVICE_ID service_id, bool enable) { return BT_STATUS_SUCCESS; }; void MockCoreInterface::removeDeviceFromProfiles(const RawAddress& bd_addr){}; void MockCoreInterface::onLinkDown(const RawAddress& bd_addr){}; system/test/common/core_interface.h +13 −0 Original line number Diff line number Diff line Loading @@ -14,5 +14,18 @@ * limitations under the License. */ #include "btif/include/btif_common.h" #include "btif/include/core_callbacks.h" #include "btif/include/stack_manager.h" void InitializeCoreInterface(); void CleanCoreInterface(); struct MockCoreInterface : bluetooth::core::CoreInterface { MockCoreInterface(); void onBluetoothEnabled() override; bt_status_t toggleProfile(tBTA_SERVICE_ID service_id, bool enable) override; void removeDeviceFromProfiles(const RawAddress& bd_addr) override; void onLinkDown(const RawAddress& bd_addr) override; }; system/test/mock/mock_bluetooth_interface.cc +18 −226 Original line number Diff line number Diff line Loading @@ -22,263 +22,55 @@ #include "stack/include/bt_octets.h" #include "types/raw_address.h" void set_hal_cbacks(bt_callbacks_t* callbacks) {} static int init(bt_callbacks_t* callbacks, bool start_restricted, bool is_common_criteria_mode, int config_compare_result, const char** init_flags, bool is_atv) { return BT_STATUS_SUCCESS; } static int enable() { return BT_STATUS_SUCCESS; } static int disable(void) { return BT_STATUS_SUCCESS; } static void cleanup(void) {} bool is_restricted_mode() { return false; } bool is_common_criteria_mode() { return false; } int get_common_criteria_config_compare_result() { return BT_STATUS_SUCCESS; } bool is_atv_device() { return false; } static int get_adapter_properties(void) { return BT_STATUS_SUCCESS; } static int get_adapter_property(bt_property_type_t type) { return BT_STATUS_SUCCESS; } static int set_adapter_property(const bt_property_t* property) { return BT_STATUS_SUCCESS; } int get_remote_device_properties(RawAddress* remote_addr) { return BT_STATUS_SUCCESS; } int get_remote_device_property(RawAddress* remote_addr, bt_property_type_t type) { return BT_STATUS_SUCCESS; } int set_remote_device_property(RawAddress* remote_addr, const bt_property_t* property) { return BT_STATUS_SUCCESS; } int get_remote_services(RawAddress* remote_addr, int transport) { return BT_STATUS_SUCCESS; } static int start_discovery(void) { return BT_STATUS_SUCCESS; } static int cancel_discovery(void) { return BT_STATUS_SUCCESS; } static int create_bond(const RawAddress* bd_addr, int transport) { return BT_STATUS_SUCCESS; } static int create_bond_le(const RawAddress* bd_addr, uint8_t addr_type) { return BT_STATUS_SUCCESS; } static int create_bond_out_of_band(const RawAddress* bd_addr, int transport, const bt_oob_data_t* p192_data, const bt_oob_data_t* p256_data) { return BT_STATUS_SUCCESS; } static int generate_local_oob_data(tBT_TRANSPORT transport) { return BT_STATUS_SUCCESS; } static int cancel_bond(const RawAddress* bd_addr) { return BT_STATUS_SUCCESS; } static int remove_bond(const RawAddress* bd_addr) { return BT_STATUS_SUCCESS; } static int get_connection_state(const RawAddress* bd_addr) { return BT_STATUS_SUCCESS; } static int pin_reply(const RawAddress* bd_addr, uint8_t accept, uint8_t pin_len, bt_pin_code_t* pin_code) { return BT_STATUS_SUCCESS; } static int ssp_reply(const RawAddress* bd_addr, bt_ssp_variant_t variant, uint8_t accept, uint32_t passkey) { return BT_STATUS_SUCCESS; } static int read_energy_info() { return BT_STATUS_SUCCESS; } static void dump(int fd, const char** arguments) {} static void dumpMetrics(std::string* output) {} static const void* get_profile_interface(const char* profile_id) { return nullptr; } int dut_mode_configure(uint8_t enable) { return BT_STATUS_SUCCESS; } int dut_mode_send(uint16_t opcode, uint8_t* buf, uint8_t len) { return BT_STATUS_SUCCESS; } static int set_os_callouts(bt_os_callouts_t* callouts) { return BT_STATUS_SUCCESS; } static int config_clear(void) { return 0; } static bluetooth::avrcp::ServiceInterface* get_avrcp_service(void) { return nullptr; } static std::string obfuscate_address(const RawAddress& address) { return std::string("Test"); } static int get_metric_id(const RawAddress& address) { return 0; } static int set_dynamic_audio_buffer_size(int codec, int size) { return 0; } static bool allow_low_latency_audio(bool allowed, const RawAddress& address) { return true; } static int clear_event_filter(void) { return 0; } static int clear_event_mask() { return 0; } static int clear_filter_accept_list() { return 0; } static int disconnect_all_acls() { return 0; } static int le_rand() { return 0; } static int set_event_filter_inquiry_result_all_devices() { return 0; } static int set_default_event_mask_except(uint64_t mask, uint64_t le_mask) { return 0; } static int restore_filter_accept_list() { return 0; } static int allow_wake_by_hid() { return 0; } static int set_event_filter_connection_setup_all_devices() { return 0; } static void metadata_changed(const RawAddress& remote_bd_addr, int key, std::vector<uint8_t> value) {} EXPORT_SYMBOL bt_interface_t bluetoothInterface = { sizeof(bluetoothInterface), init, enable, disable, cleanup, get_adapter_properties, get_adapter_property, set_adapter_property, get_remote_device_properties, get_remote_device_property, set_remote_device_property, nullptr, get_remote_services, start_discovery, cancel_discovery, create_bond, create_bond_le, create_bond_out_of_band, remove_bond, cancel_bond, get_connection_state, pin_reply, ssp_reply, get_profile_interface, dut_mode_configure, dut_mode_send, set_os_callouts, read_energy_info, dump, dumpMetrics, config_clear, interop_database_clear, interop_database_add, get_avrcp_service, obfuscate_address, get_metric_id, set_dynamic_audio_buffer_size, generate_local_oob_data, allow_low_latency_audio, clear_event_filter, clear_event_mask, clear_filter_accept_list, disconnect_all_acls, le_rand, set_event_filter_connection_setup_all_devices, allow_wake_by_hid, restore_filter_accept_list, set_default_event_mask_except, set_event_filter_inquiry_result_all_devices, metadata_changed}; // callback reporting helpers bt_property_t* property_deep_copy_array(int num_properties, bt_property_t* properties) { return nullptr; } void invoke_adapter_state_changed_cb(bt_state_t state) {} void invoke_adapter_properties_cb(bt_status_t status, int num_properties, bt_property_t* properties) {} void invoke_remote_device_properties_cb(bt_status_t status, RawAddress bd_addr, int num_properties, bt_property_t* properties) {} void invoke_device_found_cb(int num_properties, bt_property_t* properties) {} void invoke_discovery_state_changed_cb(bt_discovery_state_t state) {} void invoke_pin_request_cb(RawAddress bd_addr, bt_bdname_t bd_name, uint32_t cod, bool min_16_digit) {} void invoke_ssp_request_cb(RawAddress bd_addr, bt_bdname_t bd_name, uint32_t cod, bt_ssp_variant_t pairing_variant, uint32_t pass_key) {} void invoke_oob_data_request_cb(tBT_TRANSPORT t, bool valid, Octet16 c, Octet16 r, RawAddress raw_address, uint8_t address_type) {} void invoke_bond_state_changed_cb(bt_status_t status, RawAddress bd_addr, bt_bond_state_t state, int fail_reason) {} void invoke_address_consolidate_cb(RawAddress main_bd_addr, RawAddress secondary_bd_addr) {} void invoke_le_address_associate_cb(RawAddress main_bd_addr, RawAddress secondary_bd_addr) {} void invoke_acl_state_changed_cb(bt_status_t status, RawAddress bd_addr, bt_acl_state_t state, int transport_link_type, bt_hci_error_code_t hci_reason, bt_conn_direction_t direction, uint16_t acl_handle) {} void invoke_thread_evt_cb(bt_cb_thread_evt event) {} // takes ownership of |uid_data| void invoke_energy_info_cb(bt_activity_energy_info energy_info, bt_uid_traffic_t* uid_data) {} void invoke_link_quality_report_cb(uint64_t timestamp, int report_id, int rssi, int snr, int retransmission_count, int packets_not_receive_count, int negative_acknowledgement_count) {} static void init_stack(bluetooth::core::CoreInterface* interface) {} static void start_up_stack_async(bluetooth::core::CoreInterface* interface, ProfileStartCallback startProfiles, ProfileStopCallback stopProfiles) {} static void shut_down_stack_async(ProfileStopCallback stopProfiles) {} static void clean_up_stack(ProfileStopCallback stopProfiles) {} static bool get_stack_is_running() { return true; } static const stack_manager_t interface = {init_stack, start_up_stack_async, shut_down_stack_async, clean_up_stack, get_stack_is_running}; const stack_manager_t* stack_manager_get_interface() { return &interface; } system/test/mock/mock_bta_hh_utils.cc +6 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ struct bta_hh_read_ssr_param bta_hh_read_ssr_param; struct bta_hh_tod_spt bta_hh_tod_spt; struct bta_hh_trace_dev_db bta_hh_trace_dev_db; struct bta_hh_update_di_info bta_hh_update_di_info; struct bta_hh_le_is_hh_gatt_if bta_hh_le_is_hh_gatt_if; } // namespace bta_hh_utils } // namespace mock Loading Loading @@ -107,5 +108,10 @@ void bta_hh_update_di_info(tBTA_HH_DEV_CB* p_cb, uint16_t vendor_id, test::mock::bta_hh_utils::bta_hh_update_di_info(p_cb, vendor_id, product_id, version, flag, ctry_code); } bool bta_hh_le_is_hh_gatt_if(tGATT_IF client_if) { mock_function_count_map[__func__]++; test::mock::bta_hh_utils::bta_hh_le_is_hh_gatt_if(client_if); return false; } // Mocked functions complete // END mockcify generation Loading
system/test/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -287,6 +287,8 @@ filegroup { name: "TestMockBtif", srcs: [ ":TestCommonJniThread", ":TestCommonCoreInterface", ":TestMockBluetoothInterface", "mock/mock_btif*.cc", ], } Loading
system/test/common/core_interface.cc +57 −24 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ * limitations under the License. */ #include "core_interface.h" #include "btif/include/btif_common.h" #include "btif/include/core_callbacks.h" #include "btif/include/stack_manager.h" Loading @@ -37,34 +39,49 @@ static bluetooth::core::EventCallbacks eventCallbacks = { .invoke_energy_info_cb = invoke_energy_info_cb, .invoke_link_quality_report_cb = invoke_link_quality_report_cb}; struct MockCoreInterface : bluetooth::core::CoreInterface { void onBluetoothEnabled() override{}; bt_status_t toggleProfile(tBTA_SERVICE_ID service_id, bool enable) override { return BT_STATUS_SUCCESS; }; void removeDeviceFromProfiles(const RawAddress& bd_addr) override{}; void onLinkDown(const RawAddress& bd_addr) override{}; MockCoreInterface() : bluetooth::core::CoreInterface{&eventCallbacks, nullptr, nullptr, nullptr} {}; // This interface lets us query for configuration properties of the stack that // could change at runtime struct MockConfigInterface : public bluetooth::core::ConfigInterface { virtual bool isA2DPOffloadEnabled() { return false; } virtual bool isAndroidTVDevice() { return false; } virtual bool isRestrictedMode() { return false; } }; } // namespace static auto mockConfigInterface = MockConfigInterface{}; // This interface lets us communicate with encoders used in profiles struct MockCodecInterface : public bluetooth::core::CodecInterface { virtual void initialize(){}; virtual void cleanup() {} // HORRIBLE HACKY "MOCK" - the BTIF test target includes bluetooth.cc, so even // btif-"core" tests need this symbol to be available (since the linker doesn't // strip it for some reason) // // TODO(rahularya): remove this once build files are changed in aosp/2258765 bool bta_hh_le_is_hh_gatt_if(tGATT_IF client_if) { // If your test is not testing HID, then this is false and we are all fine. // // If your test *is* testing HID, you should get a linker error since this // symbol had better be available. In which case you will need to figure out // how to fix this properly, or have some macro to conditionally supply this // symbol. Sorry. virtual uint32_t encodePacket(int16_t* input, uint8_t* output) { return 0; }; virtual bool decodePacket(const uint8_t* i_buf, int16_t* o_buf, size_t out_len) { return false; } }; }; static auto mockCodecInterface = MockCodecInterface{}; struct bluetooth::core::HACK_ProfileInterface HACK_profileInterface = { // HID .btif_hh_connect = nullptr, .btif_hh_virtual_unplug = nullptr, .bta_hh_read_ssr_param = nullptr, .bta_hh_le_is_hh_gatt_if = nullptr, .bta_hh_cleanup_disable = nullptr, // AVDTP .btif_av_set_dynamic_audio_buffer_size = nullptr, // ASHA .GetHearingAidDeviceCount = nullptr, // LE Audio .IsLeAudioClientRunning = nullptr, }; } // namespace void InitializeCoreInterface() { static auto mockCoreInterface = MockCoreInterface{}; Loading @@ -74,3 +91,19 @@ void InitializeCoreInterface() { void CleanCoreInterface() { stack_manager_get_interface()->clean_up_stack([] {}); } MockCoreInterface::MockCoreInterface() : bluetooth::core::CoreInterface{&eventCallbacks, &mockConfigInterface, &mockCodecInterface, &HACK_profileInterface} {}; void MockCoreInterface::onBluetoothEnabled(){}; bt_status_t MockCoreInterface::toggleProfile(tBTA_SERVICE_ID service_id, bool enable) { return BT_STATUS_SUCCESS; }; void MockCoreInterface::removeDeviceFromProfiles(const RawAddress& bd_addr){}; void MockCoreInterface::onLinkDown(const RawAddress& bd_addr){};
system/test/common/core_interface.h +13 −0 Original line number Diff line number Diff line Loading @@ -14,5 +14,18 @@ * limitations under the License. */ #include "btif/include/btif_common.h" #include "btif/include/core_callbacks.h" #include "btif/include/stack_manager.h" void InitializeCoreInterface(); void CleanCoreInterface(); struct MockCoreInterface : bluetooth::core::CoreInterface { MockCoreInterface(); void onBluetoothEnabled() override; bt_status_t toggleProfile(tBTA_SERVICE_ID service_id, bool enable) override; void removeDeviceFromProfiles(const RawAddress& bd_addr) override; void onLinkDown(const RawAddress& bd_addr) override; };
system/test/mock/mock_bluetooth_interface.cc +18 −226 Original line number Diff line number Diff line Loading @@ -22,263 +22,55 @@ #include "stack/include/bt_octets.h" #include "types/raw_address.h" void set_hal_cbacks(bt_callbacks_t* callbacks) {} static int init(bt_callbacks_t* callbacks, bool start_restricted, bool is_common_criteria_mode, int config_compare_result, const char** init_flags, bool is_atv) { return BT_STATUS_SUCCESS; } static int enable() { return BT_STATUS_SUCCESS; } static int disable(void) { return BT_STATUS_SUCCESS; } static void cleanup(void) {} bool is_restricted_mode() { return false; } bool is_common_criteria_mode() { return false; } int get_common_criteria_config_compare_result() { return BT_STATUS_SUCCESS; } bool is_atv_device() { return false; } static int get_adapter_properties(void) { return BT_STATUS_SUCCESS; } static int get_adapter_property(bt_property_type_t type) { return BT_STATUS_SUCCESS; } static int set_adapter_property(const bt_property_t* property) { return BT_STATUS_SUCCESS; } int get_remote_device_properties(RawAddress* remote_addr) { return BT_STATUS_SUCCESS; } int get_remote_device_property(RawAddress* remote_addr, bt_property_type_t type) { return BT_STATUS_SUCCESS; } int set_remote_device_property(RawAddress* remote_addr, const bt_property_t* property) { return BT_STATUS_SUCCESS; } int get_remote_services(RawAddress* remote_addr, int transport) { return BT_STATUS_SUCCESS; } static int start_discovery(void) { return BT_STATUS_SUCCESS; } static int cancel_discovery(void) { return BT_STATUS_SUCCESS; } static int create_bond(const RawAddress* bd_addr, int transport) { return BT_STATUS_SUCCESS; } static int create_bond_le(const RawAddress* bd_addr, uint8_t addr_type) { return BT_STATUS_SUCCESS; } static int create_bond_out_of_band(const RawAddress* bd_addr, int transport, const bt_oob_data_t* p192_data, const bt_oob_data_t* p256_data) { return BT_STATUS_SUCCESS; } static int generate_local_oob_data(tBT_TRANSPORT transport) { return BT_STATUS_SUCCESS; } static int cancel_bond(const RawAddress* bd_addr) { return BT_STATUS_SUCCESS; } static int remove_bond(const RawAddress* bd_addr) { return BT_STATUS_SUCCESS; } static int get_connection_state(const RawAddress* bd_addr) { return BT_STATUS_SUCCESS; } static int pin_reply(const RawAddress* bd_addr, uint8_t accept, uint8_t pin_len, bt_pin_code_t* pin_code) { return BT_STATUS_SUCCESS; } static int ssp_reply(const RawAddress* bd_addr, bt_ssp_variant_t variant, uint8_t accept, uint32_t passkey) { return BT_STATUS_SUCCESS; } static int read_energy_info() { return BT_STATUS_SUCCESS; } static void dump(int fd, const char** arguments) {} static void dumpMetrics(std::string* output) {} static const void* get_profile_interface(const char* profile_id) { return nullptr; } int dut_mode_configure(uint8_t enable) { return BT_STATUS_SUCCESS; } int dut_mode_send(uint16_t opcode, uint8_t* buf, uint8_t len) { return BT_STATUS_SUCCESS; } static int set_os_callouts(bt_os_callouts_t* callouts) { return BT_STATUS_SUCCESS; } static int config_clear(void) { return 0; } static bluetooth::avrcp::ServiceInterface* get_avrcp_service(void) { return nullptr; } static std::string obfuscate_address(const RawAddress& address) { return std::string("Test"); } static int get_metric_id(const RawAddress& address) { return 0; } static int set_dynamic_audio_buffer_size(int codec, int size) { return 0; } static bool allow_low_latency_audio(bool allowed, const RawAddress& address) { return true; } static int clear_event_filter(void) { return 0; } static int clear_event_mask() { return 0; } static int clear_filter_accept_list() { return 0; } static int disconnect_all_acls() { return 0; } static int le_rand() { return 0; } static int set_event_filter_inquiry_result_all_devices() { return 0; } static int set_default_event_mask_except(uint64_t mask, uint64_t le_mask) { return 0; } static int restore_filter_accept_list() { return 0; } static int allow_wake_by_hid() { return 0; } static int set_event_filter_connection_setup_all_devices() { return 0; } static void metadata_changed(const RawAddress& remote_bd_addr, int key, std::vector<uint8_t> value) {} EXPORT_SYMBOL bt_interface_t bluetoothInterface = { sizeof(bluetoothInterface), init, enable, disable, cleanup, get_adapter_properties, get_adapter_property, set_adapter_property, get_remote_device_properties, get_remote_device_property, set_remote_device_property, nullptr, get_remote_services, start_discovery, cancel_discovery, create_bond, create_bond_le, create_bond_out_of_band, remove_bond, cancel_bond, get_connection_state, pin_reply, ssp_reply, get_profile_interface, dut_mode_configure, dut_mode_send, set_os_callouts, read_energy_info, dump, dumpMetrics, config_clear, interop_database_clear, interop_database_add, get_avrcp_service, obfuscate_address, get_metric_id, set_dynamic_audio_buffer_size, generate_local_oob_data, allow_low_latency_audio, clear_event_filter, clear_event_mask, clear_filter_accept_list, disconnect_all_acls, le_rand, set_event_filter_connection_setup_all_devices, allow_wake_by_hid, restore_filter_accept_list, set_default_event_mask_except, set_event_filter_inquiry_result_all_devices, metadata_changed}; // callback reporting helpers bt_property_t* property_deep_copy_array(int num_properties, bt_property_t* properties) { return nullptr; } void invoke_adapter_state_changed_cb(bt_state_t state) {} void invoke_adapter_properties_cb(bt_status_t status, int num_properties, bt_property_t* properties) {} void invoke_remote_device_properties_cb(bt_status_t status, RawAddress bd_addr, int num_properties, bt_property_t* properties) {} void invoke_device_found_cb(int num_properties, bt_property_t* properties) {} void invoke_discovery_state_changed_cb(bt_discovery_state_t state) {} void invoke_pin_request_cb(RawAddress bd_addr, bt_bdname_t bd_name, uint32_t cod, bool min_16_digit) {} void invoke_ssp_request_cb(RawAddress bd_addr, bt_bdname_t bd_name, uint32_t cod, bt_ssp_variant_t pairing_variant, uint32_t pass_key) {} void invoke_oob_data_request_cb(tBT_TRANSPORT t, bool valid, Octet16 c, Octet16 r, RawAddress raw_address, uint8_t address_type) {} void invoke_bond_state_changed_cb(bt_status_t status, RawAddress bd_addr, bt_bond_state_t state, int fail_reason) {} void invoke_address_consolidate_cb(RawAddress main_bd_addr, RawAddress secondary_bd_addr) {} void invoke_le_address_associate_cb(RawAddress main_bd_addr, RawAddress secondary_bd_addr) {} void invoke_acl_state_changed_cb(bt_status_t status, RawAddress bd_addr, bt_acl_state_t state, int transport_link_type, bt_hci_error_code_t hci_reason, bt_conn_direction_t direction, uint16_t acl_handle) {} void invoke_thread_evt_cb(bt_cb_thread_evt event) {} // takes ownership of |uid_data| void invoke_energy_info_cb(bt_activity_energy_info energy_info, bt_uid_traffic_t* uid_data) {} void invoke_link_quality_report_cb(uint64_t timestamp, int report_id, int rssi, int snr, int retransmission_count, int packets_not_receive_count, int negative_acknowledgement_count) {} static void init_stack(bluetooth::core::CoreInterface* interface) {} static void start_up_stack_async(bluetooth::core::CoreInterface* interface, ProfileStartCallback startProfiles, ProfileStopCallback stopProfiles) {} static void shut_down_stack_async(ProfileStopCallback stopProfiles) {} static void clean_up_stack(ProfileStopCallback stopProfiles) {} static bool get_stack_is_running() { return true; } static const stack_manager_t interface = {init_stack, start_up_stack_async, shut_down_stack_async, clean_up_stack, get_stack_is_running}; const stack_manager_t* stack_manager_get_interface() { return &interface; }
system/test/mock/mock_bta_hh_utils.cc +6 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ struct bta_hh_read_ssr_param bta_hh_read_ssr_param; struct bta_hh_tod_spt bta_hh_tod_spt; struct bta_hh_trace_dev_db bta_hh_trace_dev_db; struct bta_hh_update_di_info bta_hh_update_di_info; struct bta_hh_le_is_hh_gatt_if bta_hh_le_is_hh_gatt_if; } // namespace bta_hh_utils } // namespace mock Loading Loading @@ -107,5 +108,10 @@ void bta_hh_update_di_info(tBTA_HH_DEV_CB* p_cb, uint16_t vendor_id, test::mock::bta_hh_utils::bta_hh_update_di_info(p_cb, vendor_id, product_id, version, flag, ctry_code); } bool bta_hh_le_is_hh_gatt_if(tGATT_IF client_if) { mock_function_count_map[__func__]++; test::mock::bta_hh_utils::bta_hh_le_is_hh_gatt_if(client_if); return false; } // Mocked functions complete // END mockcify generation