1 /*
2  * Copyright 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <gtest/gtest.h>
20 
21 #include "test/common/mock_functions.h"
22 #include "test/fake/fake_osi.h"
23 #include "test/mock/mock_stack_rnr_interface.h"
24 
25 class BtmWithFakesTest : public testing::Test {
26 protected:
SetUp()27   void SetUp() override { fake_osi_ = std::make_unique<test::fake::FakeOsi>(); }
28 
TearDown()29   void TearDown() override { fake_osi_.reset(); }
30   std::unique_ptr<test::fake::FakeOsi> fake_osi_;
31 };
32 
33 // Setup any default or optional mocks
34 class BtmWithMocksTest : public BtmWithFakesTest {
35 protected:
SetUp()36   void SetUp() override {
37     BtmWithFakesTest::SetUp();
38     reset_mock_function_count_map();
39     bluetooth::testing::stack::rnr::set_interface(&mock_stack_rnr_interface_);
40   }
41 
TearDown()42   void TearDown() override { BtmWithFakesTest::TearDown(); }
43 
44   bluetooth::testing::stack::rnr::Mock mock_stack_rnr_interface_;
45 };
46