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

Commit 88441c09 authored by Chris Manton's avatar Chris Manton
Browse files

Point stack_btm_test to use common test/mocks

Bug: 183374320
Test: gd/cert/run
Tag: #refactor

Change-Id: I40c663f53914e6174ae531648c027b9cd0f7ab56
parent d5b6feb6
Loading
Loading
Loading
Loading
+22 −24
Original line number Diff line number Diff line
@@ -687,11 +687,28 @@ cc_test {
    ],
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/gd",
        "packages/modules/Bluetooth/system/vnd/ble",
    ],
    generated_headers: [
        "BluetoothGeneratedBundlerSchema_h_bfbs",
        "BluetoothGeneratedDumpsysDataSchema_h",
        "BluetoothGeneratedPackets_h",
    ],
    srcs: crypto_toolbox_srcs + [
        ":BluetoothBtaaSources_host",
        ":BluetoothHalSources_hci_host",
        ":BluetoothOsSources_host",
        ":TestMockBta",
        ":TestMockBtif",
        ":TestMockDevice",
        ":TestMockLegacyHciCommands",
        ":TestMockMainBte",
        ":TestMockMainShim",
        ":TestMockStackBtu",
        ":TestMockStackGap",
        ":TestMockStackGatt",
        ":TestMockStackSmp",
        ":TestStackL2cap",
        "acl/acl.cc",
        "acl/ble_acl.cc",
@@ -720,39 +737,19 @@ cc_test {
        "metrics/stack_metrics_logging.cc",
        "test/btm/stack_btm_test.cc",
        "test/btm/peer_packet_types_test.cc",
        "test/common/mock_bta_dm_act.cc",
        "test/common/mock_bta_sys_conn.cc",
        "test/common/mock_btif_bqr.cc",
        "test/common/mock_btif_dm.cc",
        "test/common/mock_btif_storage.cc",
        "test/common/mock_btu_hcif.cc",
        "test/common/mock_gap_gap_ble.cc",
        "test/common/mock_gatt_connection_manager.cc",
        "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_utils.cc",
        "test/common/mock_main_bte_main.cc",
        "test/common/mock_main_shim.cc",
        "test/common/mock_main_shim_acl_api.cc",
        "test/common/mock_main_shim_l2c_api.cc",
        "test/common/mock_main_shim_btm_api.cc",
        "test/common/mock_main_shim_link_policy.cc",
        "test/common/mock_smp_smp_act.cc",
        "test/common/mock_smp_smp_api.cc",
    ],
    static_libs: [
        "libbt-common",
        "libbt-protos-lite",
        "libbte",
        "libbtdevice",
        "libgmock",
        "liblog",
        "libosi",
        "libbtdevice",
    ],
    shared_libs: [
        "libprotobuf-cpp-lite",
        "libcrypto",
        "libflatbuffers-cpp",
        "libprotobuf-cpp-lite",
    ],
    sanitize: {
        address: true,
@@ -898,9 +895,10 @@ cc_test {
        "libosi",
    ],
    shared_libs: [
        "libbinder_ndk",
        "libcrypto",
        "libprotobuf-cpp-lite",
        "libflatbuffers-cpp",
        "libprotobuf-cpp-lite",
    ],
    sanitize: {
        address: true,
+9 −8
Original line number Diff line number Diff line
@@ -20,33 +20,33 @@
#include <gtest/gtest.h>
#include <map>

#include "btif/include/btif_hh.h"
#include "hci/include/hci_layer.h"
#include "hci/include/hci_packet_factory.h"
#include "hci/include/packet_fragmenter.h"
#include "internal_include/stack_config.h"
#include "osi/include/osi.h"
#include "stack/btm/btm_int_types.h"
#include "stack/include/acl_api.h"
#include "stack/include/acl_hci_link_interface.h"
#include "stack/include/btm_client_interface.h"
#include "types/raw_address.h"

#include "stack/l2cap/l2c_int.h"
#include "test/mock/mock_hcic_hcicmds.h"
#include "types/raw_address.h"

namespace mock = test::mock::hcic_hcicmds;

extern tBTM_CB btm_cb;

bluetooth::common::MessageLoopThread* get_main_thread() { return nullptr; }
uint8_t appl_trace_level = BT_TRACE_LEVEL_VERBOSE;
btif_hh_cb_t btif_hh_cb;
tL2C_CB l2cb;

const hci_packet_factory_t* hci_packet_factory_get_interface() {
  return nullptr;
}
const hci_t* hci_layer_get_interface() { return nullptr; }

bt_status_t do_in_main_thread(const base::Location& from_here,
                              base::OnceClosure task) {
  return BT_STATUS_SUCCESS;
}
void LogMsg(uint32_t trace_set_mask, const char* fmt_str, ...) {}

const std::string kSmpOptions("mock smp options");
@@ -59,6 +59,7 @@ bool get_pts_crosskey_sdp_disable(void) { return false; }
const std::string* get_pts_smp_options(void) { return &kSmpOptions; }
int get_pts_smp_failure_case(void) { return 123; }
config_t* get_all(void) { return nullptr; }
const packet_fragmenter_t* packet_fragmenter_get_interface() { return nullptr; }

stack_config_t mock_stack_config{
    .get_trace_config_enabled = get_trace_config_enabled,
@@ -76,7 +77,7 @@ const stack_config_t* stack_config_get_interface(void) {

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

bool MOCK_bluetooth_shim_is_gd_acl_enabled_;
extern bool MOCK_bluetooth_shim_is_gd_acl_enabled_;

namespace {

+35 −0
Original line number Diff line number Diff line
@@ -103,6 +103,13 @@ filegroup {
    ],
}

filegroup {
    name: "TestMockMainShimFlags",
    srcs: [
      "mock/mock_main_shim.cc",
    ],
}

filegroup {
  name: "TestMockBtif",
  srcs: [
@@ -165,3 +172,31 @@ filegroup {
      "mock/mock_stack_metrics*.cc",
  ],
}

filegroup {
  name: "TestMockStackGap",
  srcs: [
      "mock/mock_stack_gap*.cc",
  ],
}

filegroup {
  name: "TestMockStackGatt",
  srcs: [
      "mock/mock_stack_gatt*.cc",
  ],
}

filegroup {
  name: "TestMockStackBtu",
  srcs: [
      "mock/mock_stack_btu*.cc",
  ],
}

filegroup {
  name: "TestMockMainBte",
  srcs: [
      "mock/mock_main_bte*.cc",
  ],
}
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

#include "module.h"
#include "gd/module.h"

#include "btif/include/btif_activity_attribution.h"
#include "main/shim/activity_attribution.h"
Loading