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 <gmock/gmock.h> 20 21 #include <vector> 22 23 #include "stack/include/gap_api.h" 24 25 namespace bluetooth { 26 namespace testing { 27 namespace stack { 28 namespace gap_conn { 29 30 class Interface { 31 public: 32 virtual ~Interface() = default; 33 34 virtual uint16_t GAP_ConnOpen(const char* p_serv_name, uint8_t service_id, bool is_server, 35 const RawAddress* p_rem_bda, uint16_t psm, uint16_t le_mps, 36 tL2CAP_CFG_INFO* p_cfg, tL2CAP_ERTM_INFO* ertm_info, 37 uint16_t security, tGAP_CONN_CALLBACK* p_cb, 38 tBT_TRANSPORT transport) = 0; 39 40 virtual const RawAddress* GAP_ConnGetRemoteAddr(uint16_t gap_handle) = 0; 41 }; 42 43 class Mock : public Interface { 44 public: 45 ~Mock() = default; 46 47 MOCK_METHOD(uint16_t, GAP_ConnOpen, 48 (const char* p_serv_name, uint8_t service_id, bool is_server, 49 const RawAddress* p_rem_bda, uint16_t psm, uint16_t le_mps, tL2CAP_CFG_INFO* p_cfg, 50 tL2CAP_ERTM_INFO* ertm_info, uint16_t security, tGAP_CONN_CALLBACK* p_cb, 51 tBT_TRANSPORT transport)); 52 53 MOCK_METHOD(const RawAddress*, GAP_ConnGetRemoteAddr, (uint16_t gap_handle)); 54 }; 55 56 void reset_interface(); 57 void set_interface(Interface* interface_); 58 Interface& get_interface(); 59 60 } // namespace gap_conn 61 } // namespace stack 62 } // namespace testing 63 } // namespace bluetooth 64