1 /* 2 * Copyright 2019 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 #include "test/mock/mock_main_shim_entry.h" 18 19 #include "hci/acl_manager_mock.h" 20 #include "hci/controller_interface_mock.h" 21 #include "hci/distance_measurement_manager_mock.h" 22 #include "hci/hci_interface.h" 23 #include "hci/le_advertising_manager_mock.h" 24 #include "hci/le_scanning_manager_mock.h" 25 #include "lpp/lpp_offload_interface_mock.h" 26 #include "main/shim/entry.h" 27 #include "main/shim/shim.h" 28 #include "os/handler.h" 29 #include "storage/storage_module.h" 30 31 namespace test { 32 namespace mock { 33 bool bluetooth_shim_is_gd_stack_started_up = false; 34 } // namespace mock 35 } // namespace test 36 37 namespace bluetooth { 38 namespace hci { 39 namespace testing { 40 41 std::unique_ptr<MockAclManager> mock_acl_manager_; 42 std::unique_ptr<MockControllerInterface> mock_controller_; 43 std::unique_ptr<MockHciLayer> mock_hci_layer_; 44 os::Handler* mock_gd_shim_handler_{nullptr}; 45 MockLeAdvertisingManager* mock_le_advertising_manager_{nullptr}; 46 MockLeScanningManager* mock_le_scanning_manager_{nullptr}; 47 MockDistanceMeasurementManager* mock_distance_measurement_manager_{nullptr}; 48 storage::StorageModule* mock_storage_{nullptr}; 49 50 } // namespace testing 51 } // namespace hci 52 53 namespace lpp::testing { 54 MockLppOffloadInterface* mock_lpp_offload_interface_{nullptr}; 55 } // namespace lpp::testing 56 57 class Dumpsys; 58 59 namespace shim { 60 GetAclManager()61hci::AclManager* GetAclManager() { return hci::testing::mock_acl_manager_.get(); } GetController()62hci::ControllerInterface* GetController() { return hci::testing::mock_controller_.get(); } GetHciLayer()63hci::HciInterface* GetHciLayer() { return hci::testing::mock_hci_layer_.get(); } GetAdvertising()64hci::LeAdvertisingManager* GetAdvertising() { return hci::testing::mock_le_advertising_manager_; } GetScanning()65hci::LeScanningManager* GetScanning() { return hci::testing::mock_le_scanning_manager_; } GetDistanceMeasurementManager()66hci::DistanceMeasurementManager* GetDistanceMeasurementManager() { 67 return hci::testing::mock_distance_measurement_manager_; 68 } GetGdShimHandler()69os::Handler* GetGdShimHandler() { return hci::testing::mock_gd_shim_handler_; } GetSnoopLogger()70hal::SnoopLogger* GetSnoopLogger() { return nullptr; } GetStorage()71storage::StorageModule* GetStorage() { return hci::testing::mock_storage_; } GetCounterMetrics()72metrics::CounterMetrics* GetCounterMetrics() { return nullptr; } GetMsftExtensionManager()73hci::MsftExtensionManager* GetMsftExtensionManager() { return nullptr; } GetRemoteNameRequest()74hci::RemoteNameRequestModule* GetRemoteNameRequest() { return nullptr; } GetLppOffloadManager()75lpp::LppOffloadInterface* GetLppOffloadManager() { 76 return lpp::testing::mock_lpp_offload_interface_; 77 } is_gd_stack_started_up()78bool is_gd_stack_started_up() { return test::mock::bluetooth_shim_is_gd_stack_started_up; } 79 80 } // namespace shim 81 } // namespace bluetooth 82