1 /* 2 * Copyright (C) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef MOCK_VENDOR_ADAPTIONS_H 16 #define MOCK_VENDOR_ADAPTIONS_H 17 18 #include <string> 19 #include <gmock/gmock.h> 20 #include "secure_element_ca_proxy.h" 21 22 namespace OHOS { 23 namespace HDI { 24 namespace SecureElement { 25 class MockTee { 26 public: SetMockTee(MockTee & object)27 static void SetMockTee(MockTee &object) 28 { 29 obj = &object; 30 } 31 ResetMockTee()32 static void ResetMockTee() 33 { 34 obj = nullptr; 35 } 36 GetMockTee()37 static MockTee *GetMockTee() 38 { 39 return obj; 40 } 41 MOCK_METHOD(int, VendorSecureElementCaOnStart, (), ()); 42 MOCK_METHOD(int, VendorSecureElementCaInit, (), ()); 43 MOCK_METHOD(int, VendorSecureElementCaUninit, (), ()); 44 MOCK_METHOD(int, VendorSecureElementCaGetAtr, (uint8_t *rsp, uint32_t *rspLen), ()); 45 MOCK_METHOD(int, VendorSecureElementCaOpenLogicalChannel, (uint8_t *aid, uint32_t len, uint8_t p2, 46 uint8_t *rsp, uint32_t *rspLen, uint32_t *channelNum), ()); 47 MOCK_METHOD(int, VendorSecureElementCaOpenBasicChannel, (uint8_t *aid, uint32_t len, uint8_t *rsp, 48 uint32_t *rspLen), ()); 49 MOCK_METHOD(int, VendorSecureElementCaCloseChannel, (uint32_t channelNum), ()); 50 MOCK_METHOD(int, VendorSecureElementCaTransmit, (uint8_t *cmd, uint32_t cmdLen, uint8_t *rsp, 51 uint32_t *rspLen), ()); 52 private: 53 inline static MockTee *obj = nullptr; 54 }; 55 } // SecureElement 56 } // HDI 57 } // OHOS 58 59 #endif // MOCK_VENDOR_ADAPTIONS_H 60