1 /*
2  * Copyright (c) 2023 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 
16 #ifndef DEVATTEST_CLIENT_PERFORMANCE_TEST_H
17 #define DEVATTEST_CLIENT_PERFORMANCE_TEST_H
18 
19 #include <gtest/gtest.h>
20 #include "iremote_proxy.h"
21 #include "devattest_interface.h"
22 
23 namespace OHOS {
24 namespace DevAttest {
25 enum class AttestPhaseType {
26     ATTEST_PHASE_FIRST_CALL = 0,
27     ATTEST_PHASE_CLIENT,
28     ATTEST_PHASE_PROXY,
29     ATTEST_PHASE_IPC,
30     ATTEST_PHASE_MARSHALLING,
31     ATTEST_PHASE_UNMARSHALLING,
32     ATTEST_PHASE_GetSAManager,
33     ATTEST_PHASE_CheckDevAttestSA,
34     ATTEST_PHASE_MAX_TYPE,
35 };
36 
37 class DevAttestClientPerformanceTest : public testing::Test {
38 public:
39     static void SetUpTestCase(void);
40     static void TearDownTestCase(void);
41     void SetUp();
42     void TearDown();
43 };
44 
45 class DevAttestServiceProxyTest : public IRemoteProxy<DevAttestInterface> {
46 public:
DevAttestServiceProxyTest(const sptr<IRemoteObject> &impl)47     explicit DevAttestServiceProxyTest(const sptr<IRemoteObject> &impl)
48         : IRemoteProxy<DevAttestInterface>(impl) {}
~DevAttestServiceProxyTest()49     ~DevAttestServiceProxyTest() {}
50 
51     int32_t TestIPCConsume(void);
52     int32_t GetAttestStatus(AttestResultInfo &attestResultInfo) override;
53 private:
54     static inline BrokerDelegator<DevAttestServiceProxyTest> delegator_;
55 };
56 } // namespace DevAttest
57 } // namespace OHOS
58 #endif // DEVATTEST_CLIENT_PERFORMANCE_TEST_H
59