• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include <gtest/gtest.h>
16 #include <thread>
17 
18 #include "nci_ce_proxy.h"
19 
20 namespace OHOS {
21 namespace NFC {
22 namespace TEST {
23 using namespace testing::ext;
24 using namespace OHOS::NFC::NCI;
25 class NciCeProxyTest : public testing::Test {
26 public:
27     static void SetUpTestCase();
28     static void TearDownTestCase();
29     void SetUp();
30     void TearDown();
31 };
32 
SetUpTestCase()33 void NciCeProxyTest::SetUpTestCase()
34 {
35     std::cout << " SetUpTestCase NciCeProxyTest." << std::endl;
36 }
37 
TearDownTestCase()38 void NciCeProxyTest::TearDownTestCase()
39 {
40     std::cout << " TearDownTestCase NciCeProxyTest." << std::endl;
41 }
42 
SetUp()43 void NciCeProxyTest::SetUp()
44 {
45     std::cout << " SetUp NciCeProxyTest." << std::endl;
46 }
47 
TearDown()48 void NciCeProxyTest::TearDown()
49 {
50     std::cout << " TearDown NciCeProxyTest." << std::endl;
51 }
52 
53 /**
54  * @tc.name: SetCeHostListener001
55  * @tc.desc: Test NciCeProxyTest SetCeHostListener.
56  * @tc.type: FUNC
57  */
58 HWTEST_F(NciCeProxyTest, SetCeHostListener001, TestSize.Level1)
59 {
60     std::shared_ptr<NCI::INciCeInterface::ICeHostListener> listener = nullptr;
61     std::shared_ptr<NciCeProxy> nciCeProxy = std::make_shared<NciCeProxy>();
62     nciCeProxy->SetCeHostListener(listener);
63     bool computeRoutingParams = nciCeProxy->ComputeRoutingParams();
64     ASSERT_TRUE(computeRoutingParams == true);
65 }
66 
67 /**
68  * @tc.name: ComputeRoutingParams001
69  * @tc.desc: Test NciCeProxyTest ComputeRoutingParams.
70  * @tc.type: FUNC
71  */
72 HWTEST_F(NciCeProxyTest, ComputeRoutingParams001, TestSize.Level1)
73 {
74     std::shared_ptr<NciCeProxy> nciCeProxy = std::make_shared<NciCeProxy>();
75     bool computeRoutingParams = nciCeProxy->ComputeRoutingParams();
76     ASSERT_TRUE(computeRoutingParams == true);
77 }
78 
79 /**
80  * @tc.name: CommitRouting001
81  * @tc.desc: Test NciCeProxyTest CommitRouting.
82  * @tc.type: FUNC
83  */
84 HWTEST_F(NciCeProxyTest, CommitRouting001, TestSize.Level1)
85 {
86     std::shared_ptr<NciCeProxy> nciCeProxy = std::make_shared<NciCeProxy>();
87     bool commitRouting = nciCeProxy->CommitRouting();
88     ASSERT_TRUE(commitRouting == false);
89 }
90 
91 /**
92  * @tc.name: SendRawFrame001
93  * @tc.desc: Test NciCeProxyTest SendRawFrame.
94  * @tc.type: FUNC
95  */
96 HWTEST_F(NciCeProxyTest, SendRawFrame001, TestSize.Level1)
97 {
98     std::string hexCmdData = "";
99     std::shared_ptr<NciCeProxy> nciCeProxy = std::make_shared<NciCeProxy>();
100     bool sendRawFrame = nciCeProxy->SendRawFrame(hexCmdData);
101     ASSERT_TRUE(sendRawFrame == false);
102 }
103 
104 /**
105  * @tc.name: AddAidRouting001
106  * @tc.desc: Test NciCeProxyTest AddAidRouting.
107  * @tc.type: FUNC
108  */
109 HWTEST_F(NciCeProxyTest, AddAidRouting001, TestSize.Level1)
110 {
111     std::string aidStr = "";
112     int route = 0;
113     int aidInfo = 0;
114     int power = 0;
115     std::shared_ptr<NciCeProxy> nciCeProxy = std::make_shared<NciCeProxy>();
116     bool addAidRouting = nciCeProxy->AddAidRouting(aidStr, route, aidInfo, power);
117     ASSERT_TRUE(addAidRouting == false);
118 }
119 }
120 }
121 }