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 #include "dp_radar_helper_test.h"
17 #include "dp_radar_helper.h"
18
19 namespace OHOS {
20 namespace DeviceProfile {
SetUp()21 void DpRadarHelperTest::SetUp()
22 {
23 }
24
TearDown()25 void DpRadarHelperTest::TearDown()
26 {
27 }
28
SetUpTestCase()29 void DpRadarHelperTest::SetUpTestCase()
30 {
31 }
32
TearDownTestCase()33 void DpRadarHelperTest::TearDownTestCase()
34 {
35 }
36
37 HWTEST_F(DpRadarHelperTest, ReportCheckDpSa_001, testing::ext::TestSize.Level0)
38 {
39 struct RadarInfo info = { 0 };
40 info.stageRes = static_cast<int32_t>(StageRes::STAGE_SUCC);
41 bool res = DpRadarHelper::GetInstance().ReportCheckDpSa(info);
42 EXPECT_EQ(res, true);
43 }
44
45 HWTEST_F(DpRadarHelperTest, ReportCheckDpSa_002, testing::ext::TestSize.Level0)
46 {
47 struct RadarInfo info = { 0 };
48 info.stageRes = static_cast<int32_t>(StageRes::STAGE_CANCEL);
49 bool res = DpRadarHelper::GetInstance().ReportCheckDpSa(info);
50 EXPECT_EQ(res, true);
51 }
52
53 HWTEST_F(DpRadarHelperTest, ReportLoadDpSa_001, testing::ext::TestSize.Level0)
54 {
55 struct RadarInfo info = { 0 };
56 info.stageRes = static_cast<int32_t>(StageRes::STAGE_IDLE);
57 bool res = DpRadarHelper::GetInstance().ReportLoadDpSa(info);
58 EXPECT_EQ(res, true);
59 }
60
61 HWTEST_F(DpRadarHelperTest, ReportLoadDpSa_002, testing::ext::TestSize.Level0)
62 {
63 struct RadarInfo info = { 0 };
64 info.stageRes = static_cast<int32_t>(StageRes::STAGE_SUCC);
65 bool res = DpRadarHelper::GetInstance().ReportLoadDpSa(info);
66 EXPECT_EQ(res, true);
67 }
68
69 HWTEST_F(DpRadarHelperTest, ReportLoadDpSaCb_001, testing::ext::TestSize.Level0)
70 {
71 struct RadarInfo info = { 0 };
72 info.stageRes = static_cast<int32_t>(StageRes::STAGE_CANCEL);
73 bool res = DpRadarHelper::GetInstance().ReportLoadDpSaCb(info);
74 EXPECT_EQ(res, true);
75 }
76 HWTEST_F(DpRadarHelperTest, ReportLoadDpSaCb_002, testing::ext::TestSize.Level0)
77 {
78 struct RadarInfo info = { 0 };
79 info.stageRes = static_cast<int32_t>(StageRes::STAGE_IDLE);
80 bool res = DpRadarHelper::GetInstance().ReportLoadDpSaCb(info);
81 EXPECT_EQ(res, true);
82 }
83
84 HWTEST_F(DpRadarHelperTest, ReportSaCheckAuth_001, testing::ext::TestSize.Level0)
85 {
86 struct RadarInfo info = { 0 };
87 info.stageRes = static_cast<int32_t>(StageRes::STAGE_SUCC);
88 bool res = DpRadarHelper::GetInstance().ReportSaCheckAuth(info);
89 EXPECT_EQ(res, true);
90 }
91
92 HWTEST_F(DpRadarHelperTest, ReportSaCheckAuth_002, testing::ext::TestSize.Level0)
93 {
94 struct RadarInfo info = { 0 };
95 info.stageRes = static_cast<int32_t>(StageRes::STAGE_IDLE);
96 bool res = DpRadarHelper::GetInstance().ReportSaCheckAuth(info);
97 EXPECT_EQ(res, true);
98 }
99
100 HWTEST_F(DpRadarHelperTest, ReportGetData_001, testing::ext::TestSize.Level0)
101 {
102 struct RadarInfo info = { 0 };
103 info.stageRes = static_cast<int32_t>(StageRes::STAGE_SUCC);
104 bool res = DpRadarHelper::GetInstance().ReportGetData(info);
105 EXPECT_EQ(res, true);
106 }
107 HWTEST_F(DpRadarHelperTest, ReportGetData_002, testing::ext::TestSize.Level0)
108 {
109 struct RadarInfo info = { 0 };
110 info.stageRes = static_cast<int32_t>(StageRes::STAGE_IDLE);
111 bool res = DpRadarHelper::GetInstance().ReportGetData(info);
112 EXPECT_EQ(res, true);
113 }
114
115 HWTEST_F(DpRadarHelperTest, ReportAddData_001, testing::ext::TestSize.Level0)
116 {
117 struct RadarInfo info = { 0 };
118 info.stageRes = static_cast<int32_t>(StageRes::STAGE_IDLE);
119 bool res = DpRadarHelper::GetInstance().ReportAddData(info);
120 EXPECT_EQ(res, true);
121 }
122 HWTEST_F(DpRadarHelperTest, ReportAddData_002, testing::ext::TestSize.Level0)
123 {
124 struct RadarInfo info = { 0 };
125 info.stageRes = static_cast<int32_t>(StageRes::STAGE_SUCC);
126 bool res = DpRadarHelper::GetInstance().ReportAddData(info);
127 EXPECT_EQ(res, true);
128 }
129
130 HWTEST_F(DpRadarHelperTest, ReportDeleteData_001, testing::ext::TestSize.Level0)
131 {
132 struct RadarInfo info = { 0 };
133 info.stageRes = static_cast<int32_t>(StageRes::STAGE_SUCC);
134 bool res = DpRadarHelper::GetInstance().ReportDeleteData(info);
135 EXPECT_EQ(res, true);
136 }
137
138 HWTEST_F(DpRadarHelperTest, ReportDeleteData_002, testing::ext::TestSize.Level0)
139 {
140 struct RadarInfo info = { 0 };
141 info.stageRes = static_cast<int32_t>(StageRes::STAGE_IDLE);
142 bool res = DpRadarHelper::GetInstance().ReportDeleteData(info);
143 EXPECT_EQ(res, true);
144 }
145
146 HWTEST_F(DpRadarHelperTest, ReportSubscribeData_001, testing::ext::TestSize.Level0)
147 {
148 struct RadarInfo info = { 0 };
149 info.stageRes = static_cast<int32_t>(StageRes::STAGE_SUCC);
150 bool res = DpRadarHelper::GetInstance().ReportSubscribeData(info);
151 EXPECT_EQ(res, true);
152 }
153 HWTEST_F(DpRadarHelperTest, ReportSubscribeData_002, testing::ext::TestSize.Level0)
154 {
155 struct RadarInfo info = { 0 };
156 info.stageRes = static_cast<int32_t>(StageRes::STAGE_IDLE);
157 bool res = DpRadarHelper::GetInstance().ReportSubscribeData(info);
158 EXPECT_EQ(res, true);
159 }
160
161 HWTEST_F(DpRadarHelperTest, ReportNotifyDataChange_001, testing::ext::TestSize.Level0)
162 {
163 struct RadarInfo info = { 0 };
164 info.stageRes = static_cast<int32_t>(StageRes::STAGE_SUCC);
165 bool res = DpRadarHelper::GetInstance().ReportNotifyDataChange(info);
166 EXPECT_EQ(res, true);
167 }
168
169 HWTEST_F(DpRadarHelperTest, ReportUnsbscribeData_001, testing::ext::TestSize.Level0)
170 {
171 struct RadarInfo info = { 0 };
172 info.stageRes = static_cast<int32_t>(StageRes::STAGE_IDLE);
173 bool res = DpRadarHelper::GetInstance().ReportUnsbscribeData(info);
174 EXPECT_EQ(res, true);
175 }
176 HWTEST_F(DpRadarHelperTest, ReportUnsbscribeData_002, testing::ext::TestSize.Level0)
177 {
178 struct RadarInfo info = { 0 };
179 info.stageRes = static_cast<int32_t>(StageRes::STAGE_SUCC);
180 bool res = DpRadarHelper::GetInstance().ReportUnsbscribeData(info);
181 EXPECT_EQ(res, true);
182 }
183
184 HWTEST_F(DpRadarHelperTest, ReportSyncData_001, testing::ext::TestSize.Level0)
185 {
186 struct RadarInfo info = { 0 };
187 info.stageRes = static_cast<int32_t>(StageRes::STAGE_IDLE);
188 bool res = DpRadarHelper::GetInstance().ReportSyncData(info);
189 EXPECT_EQ(res, true);
190 }
191
192 HWTEST_F(DpRadarHelperTest, ReportSyncData_002, testing::ext::TestSize.Level0)
193 {
194 struct RadarInfo info = { 0 };
195 info.stageRes = static_cast<int32_t>(StageRes::STAGE_SUCC);
196 bool res = DpRadarHelper::GetInstance().ReportSyncData(info);
197 EXPECT_EQ(res, true);
198 }
199
200 HWTEST_F(DpRadarHelperTest, ReportSyncDataCb_001, testing::ext::TestSize.Level0)
201 {
202 struct RadarInfo info = { 0 };
203 info.stageRes = static_cast<int32_t>(StageRes::STAGE_SUCC);
204 bool res = DpRadarHelper::GetInstance().ReportSyncDataCb(info);
205 EXPECT_EQ(res, true);
206 }
207
208 HWTEST_F(DpRadarHelperTest, GetAnonyUdid_001, testing::ext::TestSize.Level0)
209 {
210 std::string udid = "";
211 std::string res = DpRadarHelper::GetInstance().GetAnonyUdid(udid);
212 EXPECT_EQ(res, "");
213
214 udid = "1234567890abcdef";
215 res = DpRadarHelper::GetInstance().GetAnonyUdid(udid);
216 EXPECT_EQ(res, "12345**bcdef");
217 }
218 } // namespace DeviceProfile
219 } // namespace OHOS
220