Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 49ec6977 authored by Chris Manton's avatar Chris Manton
Browse files

Add main/test::shim mocks

Bug: 181991662
Test: gd/cert/run
Tag: #refactor
No-Typo-Check: Legacy misnamed code

Change-Id: I1d84f463fe1a126f1cc685b10f77f4872088a78d
parent 0f6b3ec9
Loading
Loading
Loading
Loading
+74 −0
Original line number Diff line number Diff line
/*
 * 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:6
 */

#include <map>
#include <string>

extern std::map<std::string, int> mock_function_count_map;

#include <cstdint>
#include "osi/include/log.h"
#include "stack/btm/btm_ble_int.h"
#include "stack/btm/btm_dev.h"
#include "stack/btm/btm_sec.h"
#include "stack/gatt/connection_manager.h"
#include "stack/include/acl_api.h"
#include "stack/include/bt_types.h"
#include "stack/include/hcidefs.h"
#include "stack/include/l2cap_hci_link_interface.h"

#ifndef UNUSED_ATTR
#define UNUSED_ATTR
#endif

void acl_ble_connection_complete(const tBLE_BD_ADDR& address_with_type,
                                 uint16_t handle, uint8_t role, bool match,
                                 uint16_t conn_interval, uint16_t conn_latency,
                                 uint16_t conn_timeout) {
  mock_function_count_map[__func__]++;
}
void acl_ble_connection_fail(const tBLE_BD_ADDR& address_with_type,
                             uint16_t handle, bool enhanced,
                             tHCI_STATUS status) {
  mock_function_count_map[__func__]++;
}
void acl_ble_enhanced_connection_complete(
    const tBLE_BD_ADDR& address_with_type, uint16_t handle, uint8_t role,
    bool match, uint16_t conn_interval, uint16_t conn_latency,
    uint16_t conn_timeout, const RawAddress& local_rpa,
    const RawAddress& peer_rpa, uint8_t peer_addr_type) {
  mock_function_count_map[__func__]++;
}
void acl_ble_enhanced_connection_complete_from_shim(
    const tBLE_BD_ADDR& address_with_type, uint16_t handle, uint8_t role,
    uint16_t conn_interval, uint16_t conn_latency, uint16_t conn_timeout,
    const RawAddress& local_rpa, const RawAddress& peer_rpa,
    uint8_t peer_addr_type) {
  mock_function_count_map[__func__]++;
}
void gatt_notify_conn_update(const RawAddress& remote, uint16_t interval,
                             uint16_t latency, uint16_t timeout,
                             tHCI_STATUS status);
void acl_ble_update_event_received(tHCI_STATUS status, uint16_t handle,
                                   uint16_t interval, uint16_t latency,
                                   uint16_t timeout) {
  mock_function_count_map[__func__]++;
}
+100 −0
Original line number Diff line number Diff line
/*
 * 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:17
 */

#include <map>
#include <string>

extern std::map<std::string, int> mock_function_count_map;

#include <base/strings/stringprintf.h>
#include <cstdint>
#include <unordered_map>
#include "bt_target.h"
#include "device/include/controller.h"
#include "device/include/interop.h"
#include "main/shim/dumpsys.h"
#include "main/shim/link_policy.h"
#include "main/shim/shim.h"
#include "osi/include/log.h"
#include "stack/btm/btm_int_types.h"
#include "stack/include/btm_api.h"
#include "stack/include/btm_api_types.h"
#include "stack/include/btm_status.h"
#include "types/raw_address.h"

#ifndef UNUSED_ATTR
#define UNUSED_ATTR
#endif

bool BTM_ReadPowerMode(const RawAddress& remote_bda, tBTM_PM_MODE* p_mode) {
  mock_function_count_map[__func__]++;
  return false;
}
bool BTM_SetLinkPolicyActiveMode(const RawAddress& remote_bda) {
  mock_function_count_map[__func__]++;
  return false;
}
tBTM_CONTRL_STATE BTM_PM_ReadControllerState(void) {
  mock_function_count_map[__func__]++;
  return 0;
}
tBTM_STATUS BTM_SetPowerMode(uint8_t pm_id, const RawAddress& remote_bda,
                             const tBTM_PM_PWR_MD* p_mode) {
  mock_function_count_map[__func__]++;
  return BTM_SUCCESS;
}
tBTM_STATUS BTM_SetSsrParams(const RawAddress& remote_bda, uint16_t max_lat,
                             uint16_t min_rmt_to, uint16_t min_loc_to) {
  mock_function_count_map[__func__]++;
  return BTM_SUCCESS;
}
void BTM_PM_OnConnected(uint16_t handle, const RawAddress& remote_bda) {
  mock_function_count_map[__func__]++;
}
void BTM_PM_OnDisconnected(uint16_t handle) {
  mock_function_count_map[__func__]++;
}
void btm_pm_on_mode_change(tHCI_STATUS status, uint16_t handle,
                           tHCI_MODE current_mode, uint16_t interval) {
  mock_function_count_map[__func__]++;
}
void btm_pm_on_sniff_subrating(tHCI_STATUS status, uint16_t handle,
                               uint16_t maximum_transmit_latency,
                               uint16_t maximum_receive_latency,
                               uint16_t minimum_remote_timeout,
                               uint16_t minimum_local_timeout) {
  mock_function_count_map[__func__]++;
}
void btm_pm_proc_cmd_status(tHCI_STATUS status) {
  mock_function_count_map[__func__]++;
}
void btm_pm_proc_mode_change(tHCI_STATUS hci_status, uint16_t hci_handle,
                             tHCI_MODE hci_mode, uint16_t interval) {
  mock_function_count_map[__func__]++;
}
void btm_pm_proc_ssr_evt(uint8_t* p, UNUSED_ATTR uint16_t evt_len) {
  mock_function_count_map[__func__]++;
}
void btm_pm_reset(void) { mock_function_count_map[__func__]++; }
void process_ssr_event(tHCI_STATUS status, uint16_t handle,
                       UNUSED_ATTR uint16_t max_tx_lat, uint16_t max_rx_lat) {
  mock_function_count_map[__func__]++;
}
+35 −0
Original line number Diff line number Diff line
/*
 * 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; });
+118 −0
Original line number Diff line number Diff line
/*
 * 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__]++;
}
+150 −0
Original line number Diff line number Diff line
/*
 * 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:27
 */

#include <map>
#include <string>

extern std::map<std::string, int> mock_function_count_map;

#include <base/at_exit.h>
#include <base/bind.h>
#include <base/threading/platform_thread.h>
#include <signal.h>
#include <sys/types.h>
#include <cstdint>
#include "bt_target.h"
#include "btif/include/btif_av.h"
#include "btif/include/btif_common.h"
#include "btif/include/btif_config.h"
#include "btif/include/btif_dm.h"
#include "btif/include/btif_pan.h"
#include "btif/include/btif_profile_queue.h"
#include "btif/include/btif_sock.h"
#include "btif/include/btif_storage.h"
#include "btif/include/stack_manager.h"
#include "common/message_loop_thread.h"
#include "device/include/controller.h"
#include "osi/include/future.h"
#include "osi/include/log.h"
#include "osi/include/properties.h"
#include "stack/include/a2dp_api.h"
#include "stack/include/btm_api.h"
#include "stack/include/btm_ble_api.h"
#include "types/bluetooth/uuid.h"

#ifndef UNUSED_ATTR
#define UNUSED_ATTR
#endif

bool btif_is_dut_mode() {
  mock_function_count_map[__func__]++;
  return false;
}
bool is_on_jni_thread() {
  mock_function_count_map[__func__]++;
  return false;
}
bt_property_t* property_deep_copy(const bt_property_t* prop) {
  mock_function_count_map[__func__]++;
  return nullptr;
}
bt_status_t btif_cleanup_bluetooth() {
  mock_function_count_map[__func__]++;
  return BT_STATUS_SUCCESS;
}
bt_status_t btif_init_bluetooth() {
  mock_function_count_map[__func__]++;
  return BT_STATUS_SUCCESS;
}
bt_status_t btif_set_dynamic_audio_buffer_size(int codec, int size) {
  mock_function_count_map[__func__]++;
  return BT_STATUS_SUCCESS;
}
bt_status_t btif_transfer_context(tBTIF_CBACK* p_cback, uint16_t event,
                                  char* p_params, int param_len,
                                  tBTIF_COPY_CBACK* p_copy_cback) {
  mock_function_count_map[__func__]++;
  return BT_STATUS_SUCCESS;
}
bt_status_t do_in_jni_thread(base::OnceClosure task) {
  mock_function_count_map[__func__]++;
  return BT_STATUS_SUCCESS;
}
bt_status_t do_in_jni_thread(const base::Location& from_here,
                             base::OnceClosure task) {
  mock_function_count_map[__func__]++;
  return BT_STATUS_SUCCESS;
}
btbase::AbstractMessageLoop* get_jni_message_loop() {
  mock_function_count_map[__func__]++;
  return nullptr;
}
int btif_is_enabled(void) {
  mock_function_count_map[__func__]++;
  return 0;
}
tBTA_SERVICE_MASK btif_get_enabled_services_mask(void) {
  mock_function_count_map[__func__]++;
  return 0;
}
void DynamicAudiobufferSizeCompleteCallback(tBTM_VSC_CMPL* p_vsc_cmpl_params) {
  mock_function_count_map[__func__]++;
}
void btif_adapter_properties_evt(bt_status_t status, uint32_t num_props,
                                 bt_property_t* p_props) {
  mock_function_count_map[__func__]++;
}
void btif_disable_service(tBTA_SERVICE_ID service_id) {
  mock_function_count_map[__func__]++;
}
void btif_dut_mode_configure(uint8_t enable) {
  mock_function_count_map[__func__]++;
}
void btif_dut_mode_send(uint16_t opcode, uint8_t* buf, uint8_t len) {
  mock_function_count_map[__func__]++;
}
void btif_enable_bluetooth_evt() { mock_function_count_map[__func__]++; }
void btif_enable_service(tBTA_SERVICE_ID service_id) {
  mock_function_count_map[__func__]++;
}
void btif_get_adapter_properties(void) { mock_function_count_map[__func__]++; }
void btif_get_adapter_property(bt_property_type_t type) {
  mock_function_count_map[__func__]++;
}
void btif_get_remote_device_properties(RawAddress remote_addr) {
  mock_function_count_map[__func__]++;
}
void btif_get_remote_device_property(RawAddress remote_addr,
                                     bt_property_type_t type) {
  mock_function_count_map[__func__]++;
}
void btif_init_ok() { mock_function_count_map[__func__]++; }
void btif_remote_properties_evt(bt_status_t status, RawAddress* remote_addr,
                                uint32_t num_props, bt_property_t* p_props) {
  mock_function_count_map[__func__]++;
}
void btif_set_adapter_property(bt_property_t* property) {
  mock_function_count_map[__func__]++;
}
void btif_set_remote_device_property(RawAddress* remote_addr,
                                     bt_property_t* property) {
  mock_function_count_map[__func__]++;
}
Loading