1 /****************************************************************************** 2 * 3 * Copyright 2022 The Android Open Source Project 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at: 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ******************************************************************************/ 18 #pragma once 19 20 #include <gmock/gmock.h> 21 22 #include <cstddef> 23 24 namespace bluetooth { 25 namespace manager { 26 27 class BtifConfigInterface { 28 public: 29 virtual bool GetBin(const std::string& section, const std::string& key, 30 uint8_t* value, size_t* length) = 0; 31 virtual size_t GetBinLength(const std::string& section, 32 const std::string& key) = 0; 33 virtual ~BtifConfigInterface() = default; 34 }; 35 36 class MockBtifConfigInterface : public BtifConfigInterface { 37 public: 38 MOCK_METHOD4(GetBin, bool(const std::string& section, const std::string& key, 39 uint8_t* value, size_t* length)); 40 MOCK_METHOD2(GetBinLength, 41 size_t(const std::string& section, const std::string& key)); 42 }; 43 44 /** 45 * Set the {@link MockBtifConfigInterface} for testing 46 * 47 * @param mock_btif_config_interface pointer to mock btif config interface, 48 * could be null 49 */ 50 void SetMockBtifConfigInterface( 51 MockBtifConfigInterface* mock_btif_config_interface); 52 53 } // namespace manager 54 } // namespace bluetooth 55