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

Commit 5e98722f authored by Chris Manton's avatar Chris Manton Committed by Automerger Merge Worker
Browse files

mock: Remove unused includes am: 0a0834b5

parents e4ac348c 0a0834b5
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -503,6 +503,21 @@ filegroup {
    ],
}

filegroup {
  name: "TestMockGdOsLoggingLogRedaction",
  srcs: [
      "mock/mock_gd_os_logging_log_redaction.cc"
  ],
}

filegroup {
  name: "TestFakeOsi",
  srcs: [
      ":TestMockOsi",
      "fake/fake_osi.cc"
  ],
}

cc_defaults {
    name: "mts_defaults",
    target: {
+60 −0
Original line number Diff line number Diff line
/*
 * Copyright 2023 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.
 */

#include "test/fake/fake_osi.h"

#include "test/mock/mock_osi_alarm.h"
#include "test/mock/mock_osi_allocator.h"

// Must be global to resolve the symbol within the legacy stack
struct alarm_t {
  alarm_t(const char* name){};
  int any_value;
};

namespace test {
namespace fake {

FakeOsi::FakeOsi() {
  test::mock::osi_alarm::alarm_free.body = [](alarm_t* alarm) { delete alarm; };
  test::mock::osi_alarm::alarm_new.body = [](const char* name) -> alarm_t* {
    return new alarm_t(name);
  };
  test::mock::osi_allocator::osi_calloc.body = [](size_t size) {
    return calloc(1UL, size);
  };
  test::mock::osi_allocator::osi_free.body = [](void* ptr) { free(ptr); };
  test::mock::osi_allocator::osi_free_and_reset.body = [](void** ptr) {
    free(*ptr);
    *ptr = nullptr;
  };
  test::mock::osi_allocator::osi_malloc.body = [](size_t size) {
    return malloc(size);
  };
}

FakeOsi::~FakeOsi() {
  test::mock::osi_alarm::alarm_free = {};
  test::mock::osi_alarm::alarm_new = {};

  test::mock::osi_allocator::osi_calloc = {};
  test::mock::osi_allocator::osi_free = {};
  test::mock::osi_allocator::osi_free_and_reset = {};
  test::mock::osi_allocator::osi_malloc = {};
}

}  // namespace fake
}  // namespace test
+29 −0
Original line number Diff line number Diff line
/*
 * Copyright 2023 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

namespace test {
namespace fake {

class FakeOsi {
 public:
  FakeOsi();
  ~FakeOsi();
};

}  // namespace fake
}  // namespace test
+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@

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

// Original usings

+0 −16
Original line number Diff line number Diff line
@@ -36,24 +36,8 @@
//       for this effort.  This compilation unit may compile as-is, or
//       may need attention to prune from (or add to ) the inclusion set.
#include <base/functional/bind.h>
#include <base/logging.h>
#include <base/task/cancelable_task_tracker.h>
#include <base/threading/thread.h>

#include <mutex>
#include <sstream>

#include "abstract_message_loop.h"
#include "bta/sys/bta_sys.h"
#include "btif/avrcp/avrcp_service.h"
#include "btif/include/btif_av.h"
#include "btif/include/btif_common.h"
#include "btif/include/btif_dm.h"
#include "profile/avrcp/device.h"
#include "stack/include/bt_hdr.h"
#include "stack/include/btu.h"
#include "types/bluetooth/uuid.h"
#include "types/raw_address.h"

// Original usings

Loading