1 /* 2 * Copyright (C) 2022 Huawei Technologies Co., Ltd. 3 * Licensed under the Mulan PSL v2. 4 * You can use this software according to the terms and conditions of the Mulan PSL v2. 5 * You may obtain a copy of Mulan PSL v2 at: 6 * http://license.coscl.org.cn/MulanPSL2 7 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR 8 * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR 9 * PURPOSE. 10 * See the Mulan PSL v2 for more details. 11 */ 12 13 #ifndef __PUBLIC_TEST_H__ 14 #define __PUBLIC_TEST_H__ 15 16 #include "empty_test.h" 17 18 #include <securec.h> 19 #include <tee_client_api.h> 20 #include <tee_client_type.h> 21 22 #define TEST_UUID \ 23 { \ 24 0x11111111, 0x0000, 0x0000, \ 25 { \ 26 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 \ 27 } \ 28 } 29 30 class PublicTest : public TeeBasicTestFram { 31 private: 32 static TEEC_Context context; 33 static TEEC_Session session; 34 static TEEC_UUID uuid; 35 36 public: 37 static void SetUpTestCase(); 38 static void TearDownTestCase(); 39 static void SetUuid(const TEEC_UUID &uuid); 40 GetSession()41 TEEC_Session *GetSession() 42 { 43 return &PublicTest::session; 44 } SetUp()45 void SetUp() {} TearDown()46 void TearDown() {} 47 }; 48 49 class TeeBasicTestFramWithInitContext : public ::testing::Test { 50 private: 51 static TEEC_Context context; 52 static TEEC_Session session; 53 static TEEC_SharedMemory sharedMem; 54 55 public: SetUpTestCase()56 static void SetUpTestCase() {}; TearDownTestCase()57 static void TearDownTestCase() {}; 58 GetContext()59 TEEC_Context *GetContext() 60 { 61 return &TeeBasicTestFramWithInitContext::context; 62 } GetSession()63 TEEC_Session *GetSession() 64 { 65 return &TeeBasicTestFramWithInitContext::session; 66 } GetSharedMem()67 TEEC_SharedMemory *GetSharedMem() 68 { 69 return &TeeBasicTestFramWithInitContext::sharedMem; 70 } 71 void SetUp(); 72 73 void TearDown(); 74 }; 75 76 #endif 77