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

Commit 7c242acf authored by William Escande's avatar William Escande
Browse files

Mock static initialization order 04

cpp static order initialization is not guarantee.
In order to avoid the mess, we need to have a lazy init schema.
Replacing all clear with the function call:
```
's|mock_function_count_map.clear()|reset_mock_function_count_map()|'
```

Bug: 265217208
Test: atest --host
Change-Id: I65bf13382a0193393de017696bbeccd2b273ef07
parent 2506317f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -326,7 +326,7 @@ class CsisClientTest : public ::testing::Test {

 protected:
  void SetUp(void) override {
    mock_function_count_map.clear();
    reset_mock_function_count_map();
    bluetooth::manager::SetMockBtmInterface(&btm_interface);
    dm::SetMockBtaDmInterface(&dm_interface);
    gatt::SetMockBtaGattInterface(&gatt_interface);
+1 −1
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ class MockGroupsCallbacks : public DeviceGroupsCallbacks {
class GroupsTest : public ::testing::Test {
 protected:
  void SetUp() override {
    mock_function_count_map.clear();
    reset_mock_function_count_map();
    callbacks.reset(new MockGroupsCallbacks());
  }

+1 −1
Original line number Diff line number Diff line
@@ -195,7 +195,7 @@ class BroadcasterTest : public Test {
  void SetUp() override {
    init_message_loop_thread();

    mock_function_count_map.clear();
    reset_mock_function_count_map();
    ON_CALL(controller_interface_, SupportsBleIsochronousBroadcaster)
        .WillByDefault(Return(true));

+1 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ class MockBroadcastStatMachineCallbacks
class StateMachineTest : public Test {
 protected:
  void SetUp() override {
    mock_function_count_map.clear();
    reset_mock_function_count_map();
    BleAdvertisingManager::Initialize(nullptr);

    ble_advertising_manager_ = BleAdvertisingManager::Get();
+1 −1
Original line number Diff line number Diff line
@@ -175,7 +175,7 @@ class StateMachineTest : public Test {

  void SetUp() override {
    bluetooth::common::InitFlags::Load(test_flags);
    mock_function_count_map.clear();
    reset_mock_function_count_map();
    controller::SetMockControllerInterface(&mock_controller_);
    bluetooth::manager::SetMockBtmInterface(&btm_interface);
    gatt::SetMockBtaGattInterface(&gatt_interface);
Loading