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

Commit 0af94ba1 authored by Yuyang Huang's avatar Yuyang Huang
Browse files

add HFP mock files and dependency libraries for testing

Bug: 294134504
Test: m net_test_bta
Flag: EXEMPT, test infrastructure only
Change-Id: Ib382f9beff6808fdba43589d4a23011dba0f0b00
parent 0822237f
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -268,12 +268,17 @@ cc_test {
        "BluetoothGeneratedDumpsysDataSchema_h",
    ],
    shared_libs: [
        "android.hardware.bluetooth.audio-V4-ndk",
        "android.hardware.bluetooth.audio@2.0",
        "android.hardware.bluetooth.audio@2.1",
        "libbase",
        "libbinder_ndk",
        "libcrypto",
        "libcutils",
        "libfmq",
        "libhidlbase",
        "liblog",
        "libutils",
        "server_configurable_flags",
    ],
    static_libs: [
+6 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ struct get_remote_services get_remote_services;
struct le_test_mode le_test_mode;
struct set_remote_device_property set_remote_device_property;
struct set_hal_cbacks set_hal_cbacks;
struct invoke_switch_buffer_size_cb invoke_switch_buffer_size_cb;

}  // namespace btif_bluetooth
}  // namespace mock
@@ -108,5 +109,10 @@ void set_hal_cbacks(bt_callbacks_t* callbacks) {
  inc_func_call_count(__func__);
  test::mock::btif_bluetooth::set_hal_cbacks(callbacks);
}
void invoke_switch_buffer_size_cb(bool invoke_switch_buffer_size_cb) {
  inc_func_call_count(__func__);
  test::mock::btif_bluetooth::invoke_switch_buffer_size_cb(
      invoke_switch_buffer_size_cb);
}

// END mockcify generation
+11 −0
Original line number Diff line number Diff line
@@ -149,6 +149,17 @@ struct set_hal_cbacks {
};
extern struct set_hal_cbacks set_hal_cbacks;

// Name: invoke_switch_buffer_size_cb
// Params: bool invoke_switch_buffer_size_cb
// Returns: void
struct invoke_switch_buffer_size_cb {
  std::function<void(bool invoke_switch_buffer_size_cb)> body{[](bool) {}};
  void operator()(bool invoke_switch_buffer_size_cb) {
    body(invoke_switch_buffer_size_cb);
  };
};
extern struct invoke_switch_buffer_size_cb invoke_switch_buffer_size_cb;

}  // namespace btif_bluetooth
}  // namespace mock
}  // namespace test
+55 −0
Original line number Diff line number Diff line
/*
 * Copyright 2024 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:0
 *
 *  mockcify.pl ver 0.7.0
 */

// Mock include file to share data between tests and mock
#include "test/mock/mock_btif_hf.h"

#include <cstdint>

#include "test/common/mock_functions.h"

// Original usings

// Mocked internal structures, if any

namespace test {
namespace mock {
namespace btif_hf {

// Function state capture and return values, if needed
struct GetInterface GetInterface;
}  // namespace btif_hf
}  // namespace mock
}  // namespace test

// Mocked functions, if any
namespace bluetooth {
namespace headset {
Interface* GetInterface() {
  inc_func_call_count(__func__);
  return test::mock::btif_hf::GetInterface();
}
}  // namespace headset
}  // namespace bluetooth

// Mocked functions complete
// END mockcify generation
+62 −0
Original line number Diff line number Diff line
/*
 * Copyright 2024 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.
 */
#pragma once

/*
 * Generated mock file from original source file
 *   Functions generated:0
 *
 *  mockcify.pl ver 0.7.0
 */

#include <cstdint>
#include <functional>

#include "include/hardware/bluetooth_headset_interface.h"

// 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 from (or add to ) the inclusion set.

// Original usings

// Mocked compile conditionals, if any

namespace test {
namespace mock {
namespace btif_hf {

// Shared state between mocked functions and tests
// Name: GetInterface
// Params:
// Returns: bluetooth::headset::Interface*

struct GetInterface {
  std::function<bluetooth::headset::Interface*()> body{
      []() { return nullptr; }};
  bluetooth::headset::Interface* operator()() { return body(); };
};
extern struct GetInterface GetInterface;

// Shared state between mocked functions and tests
}  // namespace btif_hf
}  // namespace mock
}  // namespace test

// END mockcify generation
 No newline at end of file