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

Commit 65e62735 authored by Chris Manton's avatar Chris Manton
Browse files

Add test mock filegroup TestMockLegacyHciCommands

Bug: 182370398
Test: gd/cert/run
Tag: #refactor
BYPASS_LONG_LINES_REASON: Bluetooth likes 120 lines

Change-Id: I968195c790eced00134739cbb9b6c9c060193d97
parent 3cc5af2e
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -689,6 +689,7 @@ cc_test {
    ],
    srcs: crypto_toolbox_srcs + [
        ":TestMockDevice",
        ":TestMockLegacyHciCommands",
        "acl/acl.cc",
        "acl/ble_acl.cc",
        "acl/btm_acl.cc",
@@ -726,8 +727,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_hcic_hciblecmds.cc",
        "test/common/mock_hcic_hcicmds.cc",
        "test/common/mock_l2cap_l2c_api.cc",
        "test/common/mock_l2cap_l2c_ble.cc",
        "test/common/mock_l2cap_l2c_link.cc",
+7 −0
Original line number Diff line number Diff line
@@ -89,3 +89,10 @@ filegroup {
    ],
}

filegroup {
    name: "TestMockLegacyHciCommands",
    srcs: [
      "mock/mock_hcic_*.cc",
    ],
}
+22 −1
Original line number Diff line number Diff line
@@ -26,13 +26,31 @@ extern std::map<std::string, int> mock_function_count_map;
#define UNUSED_ATTR

#include <stddef.h>
#include <string.h>
#include "types/raw_address.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"

namespace test {
namespace mock {
namespace hcic_hcicmds {

struct btsnd_hcic_change_conn_type {
  uint16_t handle{0};
  uint16_t packet_types{0};
} btsnd_hcic_change_conn_type;

}  // namespace hcic_hcicmds
}  // namespace mock
}  // namespace test

namespace mock = test::mock::hcic_hcicmds;

// Global by definition
void btsnd_hcic_accept_conn(const RawAddress& dest, uint8_t role) {
  mock_function_count_map[__func__]++;
}
@@ -51,6 +69,8 @@ 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::btsnd_hcic_change_conn_type.handle = handle;
  mock::btsnd_hcic_change_conn_type.packet_types = packet_types;
  mock_function_count_map[__func__]++;
}
void btsnd_hcic_change_name(BD_NAME name) {
@@ -296,6 +316,7 @@ void btsnd_hcic_write_voice_settings(uint16_t flags) {
bluetooth::legacy::hci::Interface interface_ = {
    .Disconnect = btsnd_hcic_disconnect,
    .StartRoleSwitch = btsnd_hcic_switch_role,
    .ChangeConnectionPacketType = btsnd_hcic_change_conn_type,
};

const bluetooth::legacy::hci::Interface&
+55 −0
Original line number Diff line number Diff line
/*
 * 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:1
 *
 *  mockcify.pl ver 0.2
 */

#include <map>
#include <string>

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

// Original included files, if any
// NOTE: Since this is a mock file with mock definitions some number of
//       include files may not be required.  The include-what-you-use
//       still applies, but crafting proper inclusion is out of scope
//       for this effort.  This compilation unit may compile as-is, or
//       may need attention to prune the inclusion set.

// Mocked compile conditionals, if any
#ifndef UNUSED_ATTR
#define UNUSED_ATTR
#endif

namespace test {
namespace mock {
namespace hcic_hcicmds {

struct btsnd_hcic_change_conn_type {
  uint16_t handle;
  uint16_t packet_types;
};
extern struct btsnd_hcic_change_conn_type btsnd_hcic_change_conn_type;

}  // namespace hcic_hcicmds
}  // namespace mock
}  // namespace test

// END mockcify generation