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

Commit 1e61f2ce authored by William Escande's avatar William Escande
Browse files

Mock static initialization order 22

cpp static order initialization is not guarantee.
In order to avoid the mess, we need to have a lazy init schema.
Replacing all remaining mock incrementation
```
's|mock_function_count_map\[__func__\]++|inc_func_call_count(__func__)|'
```

Bug: 265217208
Test: atest --host
Change-Id: I7d0ebeb36837211164532ec3a2bf90b1c77b21dc
parent e901ed0c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -121,7 +121,7 @@ void BTA_GATTC_Open(tGATT_IF client_if, const RawAddress& remote_bda,
                    tBLE_ADDR_TYPE addr_type,
                    tBTM_BLE_CONN_TYPE connection_type, tBT_TRANSPORT transport,
                    bool opportunistic, uint8_t initiating_phys) {
  mock_function_count_map[__func__]++;
  inc_func_call_count(__func__);
}
void BTA_GATTC_PrepareWrite(uint16_t conn_id, uint16_t handle, uint16_t offset,
                            std::vector<uint8_t> value, tGATT_AUTH_REQ auth_req,
+1 −1
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ bool check_cod_hid(const RawAddress& remote_bdaddr) {
  return false;
}
bool is_device_le_audio_capable(const RawAddress bd_addr) {
  mock_function_count_map[__func__]++;
  inc_func_call_count(__func__);
  return false;
}
uint16_t btif_dm_get_connection_state(const RawAddress* bd_addr) {
+2 −2
Original line number Diff line number Diff line
@@ -240,9 +240,9 @@ void btif_storage_remove_csis_device(const RawAddress& address) {
}
void btif_storage_set_pce_profile_version(const RawAddress& remote_bd_addr,
                                          uint16_t peer_pce_version) {
  mock_function_count_map[__func__]++;
  inc_func_call_count(__func__);
}
bool btif_storage_is_pce_version_102(const RawAddress& remote_bd_addr) {
  mock_function_count_map[__func__]++;
  inc_func_call_count(__func__);
  return false;
}
+1 −1
Original line number Diff line number Diff line
@@ -90,5 +90,5 @@ int interop_feature_name_to_feature_id(const char* feature_name) {

void interop_database_add_addr(const uint16_t feature, const RawAddress* addr,
                               size_t length) {
  mock_function_count_map[__func__]++;
  inc_func_call_count(__func__);
}
+1 −1
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ void bluetooth::shim::LogMetricA2dpPlaybackEvent(const RawAddress& raw_address,
void bluetooth::shim::LogMetricHfpPacketLossStats(const RawAddress& raw_address,
                                                  int num_decoded_frames,
                                                  double packet_loss_ratio) {
  mock_function_count_map[__func__]++;
  inc_func_call_count(__func__);
  test::mock::main_shim_metrics_api::LogMetricHfpPacketLossStats(
      raw_address, num_decoded_frames, packet_loss_ratio);
}
Loading