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

Commit 974c72cc authored by Chris Manton's avatar Chris Manton
Browse files

Encapsulate hal callback post_to_main_message_loop

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

Change-Id: Id54d785ce752c905c2920a04806de65724d60a9c
parent 3b2d6068
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -91,7 +91,5 @@ const hci_t* hci_layer_get_test_interface(
    const btsnoop_t* btsnoop_interface,
    const packet_fragmenter_t* packet_fragmenter_interface);

void post_to_main_message_loop(const base::Location& from_here, BT_HDR* p_msg);

void hci_layer_cleanup_interface();
bool hci_is_root_inflammation_event_received();
+2 −1
Original line number Diff line number Diff line
@@ -66,7 +66,8 @@ extern void btu_hci_msg_process(BT_HDR* p_msg);
 * Returns          None
 *
 *****************************************************************************/
void post_to_main_message_loop(const base::Location& from_here, BT_HDR* p_msg) {
static void post_to_main_message_loop(const base::Location& from_here,
                                      BT_HDR* p_msg) {
  if (do_in_main_thread(from_here, base::Bind(&btu_hci_msg_process, p_msg)) !=
      BT_STATUS_SUCCESS) {
    LOG(ERROR) << __func__ << ": do_in_main_thread failed from "
+0 −3
Original line number Diff line number Diff line
@@ -43,6 +43,3 @@ void bte_main_hci_send(BT_HDR* p_msg, uint16_t event) {
  mock_function_count_map[__func__]++;
}
void bte_main_init(void) { mock_function_count_map[__func__]++; }
void post_to_main_message_loop(const base::Location& from_here, BT_HDR* p_msg) {
  mock_function_count_map[__func__]++;
}
+0 −5
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@ namespace mock {
namespace main_bte {

// Function state capture and return values, if needed
struct post_to_main_message_loop post_to_main_message_loop;
struct bte_main_init bte_main_init;
struct bte_main_hci_send bte_main_hci_send;

@@ -52,10 +51,6 @@ struct bte_main_hci_send bte_main_hci_send;
}  // namespace test

// Mocked functions, if any
void post_to_main_message_loop(const base::Location& from_here, BT_HDR* p_msg) {
  mock_function_count_map[__func__]++;
  test::mock::main_bte::post_to_main_message_loop(from_here, p_msg);
}
void bte_main_init(void) {
  mock_function_count_map[__func__]++;
  test::mock::main_bte::bte_main_init();
+0 −11
Original line number Diff line number Diff line
@@ -60,17 +60,6 @@ namespace mock {
namespace main_bte {

// Shared state between mocked functions and tests
// Name: post_to_main_message_loop
// Params: const base::Location& from_here, BT_HDR* p_msg
// Returns: void
struct post_to_main_message_loop {
  std::function<void(const base::Location& from_here, BT_HDR* p_msg)> body{
      [](const base::Location& from_here, BT_HDR* p_msg) {}};
  void operator()(const base::Location& from_here, BT_HDR* p_msg) {
    body(from_here, p_msg);
  };
};
extern struct post_to_main_message_loop post_to_main_message_loop;
// Name: bte_main_init
// Params: void
// Returns: void