• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024-2025 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 "event_checker_test.h"
17 
18 #include "parameter_ex.h"
19 #include "compliant_event_checker.h"
20 
21 namespace OHOS {
22 namespace HiviewDFX {
23 
SetUpTestCase()24 void EventCheckerTest::SetUpTestCase() {}
25 
TearDownTestCase()26 void EventCheckerTest::TearDownTestCase() {}
27 
SetUp()28 void EventCheckerTest::SetUp() {}
29 
TearDown()30 void EventCheckerTest::TearDown() {}
31 
32 /**
33  * @tc.name: EventCheckerTest001
34  * @tc.desc: Test isCompliantRule apis of RuleChecker
35  * @tc.type: FUNC
36  * @tc.require: issueIAPJKN
37  */
38 HWTEST_F(EventCheckerTest, EventCheckerTest001, testing::ext::TestSize.Level3)
39 {
40     CompliantEventChecker eventChecker;
41     if (Parameter::GetInteger("const.secure", 1) == 0) { // 1 and 0 is test value
42         ASSERT_TRUE(eventChecker.IsCompliantEvent("AAFWK", ""));
43     } else {
44         ASSERT_TRUE(eventChecker.IsCompliantEvent("AAFWK", ""));
45     }
46 }
47 
48 /**
49  * @tc.name: EventCheckerTest002
50  * @tc.desc: Test isCompliantRule apis of RuleChecker
51  * @tc.type: FUNC
52  * @tc.require: issueIAPJKN
53  */
54 HWTEST_F(EventCheckerTest, EventCheckerTest002, testing::ext::TestSize.Level3)
55 {
56     CompliantEventChecker eventChecker;
57     if (Parameter::GetInteger("const.secure", 1) == 0) { // 1 and 0 is test value
58         ASSERT_TRUE(eventChecker.IsCompliantEvent("AAFWK", "START_ABILITY"));
59     } else {
60         ASSERT_FALSE(eventChecker.IsCompliantEvent("AAFWK", "START_ABILITY"));
61     }
62 }
63 
64 /**
65  * @tc.name: EventCheckerTest003
66  * @tc.desc: Test isCompliantRule apis of RuleChecker
67  * @tc.type: FUNC
68  * @tc.require: issueIAPJKN
69  */
70 HWTEST_F(EventCheckerTest, EventCheckerTest003, testing::ext::TestSize.Level3)
71 {
72     CompliantEventChecker eventChecker;
73     if (Parameter::GetInteger("const.secure", 1) == 0) { // 1 and 0 is test value
74         ASSERT_TRUE(eventChecker.IsCompliantEvent("ACE", "INTERACTION_COMPLETED_LATENCY"));
75     } else {
76         ASSERT_FALSE(eventChecker.IsCompliantEvent("ACE", "INTERACTION_COMPLETED_LATENCY"));
77     }
78 }
79 
80 /**
81  * @tc.name: EventCheckerTest004
82  * @tc.desc: Test isCompliantRule apis of RuleChecker
83  * @tc.type: FUNC
84  * @tc.require: issueIAPJKN
85  */
86 HWTEST_F(EventCheckerTest, EventCheckerTest004, testing::ext::TestSize.Level3)
87 {
88     CompliantEventChecker eventChecker;
89     if (Parameter::GetInteger("const.secure", 1) == 0) { // 1 and 0 is test value
90         ASSERT_TRUE(eventChecker.IsCompliantEvent("AV_CODEC", "CODEC_START_INFO"));
91     } else {
92         ASSERT_FALSE(eventChecker.IsCompliantEvent("AV_CODEC", "CODEC_START_INFO"));
93     }
94 }
95 
96 /**
97  * @tc.name: EventCheckerTest005
98  * @tc.desc: Test isCompliantRule apis of RuleChecker
99  * @tc.type: FUNC
100  * @tc.require: issueIAPJKN
101  */
102 HWTEST_F(EventCheckerTest, EventCheckerTest005, testing::ext::TestSize.Level3)
103 {
104     CompliantEventChecker eventChecker;
105     if (Parameter::GetInteger("const.secure", 1) == 0) { // 1 and 0 is test value
106         ASSERT_TRUE(eventChecker.IsCompliantEvent("GRAPHIC", "INTERACTION_COMPLETED_LATENCY"));
107     } else {
108         ASSERT_FALSE(eventChecker.IsCompliantEvent("GRAPHIC", "INTERACTION_COMPLETED_LATENCY"));
109     }
110 }
111 
112 /**
113  * @tc.name: EventCheckerTest006
114  * @tc.desc: Test isCompliantRule apis of RuleChecker
115  * @tc.type: FUNC
116  * @tc.require: issueIAPJKN
117  */
118 HWTEST_F(EventCheckerTest, EventCheckerTest006, testing::ext::TestSize.Level3)
119 {
120     CompliantEventChecker eventChecker;
121     if (Parameter::GetInteger("const.secure", 1) == 0) { // 1 and 0 is test value
122         ASSERT_TRUE(eventChecker.IsCompliantEvent("LOCATION", "GNSS_STATE"));
123     } else {
124         ASSERT_FALSE(eventChecker.IsCompliantEvent("LOCATION", "GNSS_STATE"));
125     }
126 }
127 
128 /**
129  * @tc.name: EventCheckerTest007
130  * @tc.desc: Test isCompliantRule apis of RuleChecker
131  * @tc.type: FUNC
132  * @tc.require: issueIAPJKN
133  */
134 HWTEST_F(EventCheckerTest, EventCheckerTest007, testing::ext::TestSize.Level3)
135 {
136     CompliantEventChecker eventChecker;
137     if (Parameter::GetInteger("const.secure", 1) == 0) { // 1 and 0 is test value
138         ASSERT_TRUE(eventChecker.IsCompliantEvent("PERFORMANCE", ""));
139     } else {
140         ASSERT_FALSE(eventChecker.IsCompliantEvent("PERFORMANCE", ""));
141     }
142 }
143 
144 /**
145  * @tc.name: EventCheckerTest008
146  * @tc.desc: Test isCompliantRule apis of RuleChecker
147  * @tc.type: FUNC
148  * @tc.require: issueIAPJKN
149  */
150 HWTEST_F(EventCheckerTest, EventCheckerTest008, testing::ext::TestSize.Level3)
151 {
152     CompliantEventChecker eventChecker;
153     if (Parameter::GetInteger("const.secure", 1) == 0) { // 1 and 0 is test value
154         ASSERT_TRUE(eventChecker.IsCompliantEvent("RELIBILITY", ""));
155     } else {
156         ASSERT_FALSE(eventChecker.IsCompliantEvent("RELIBILITY", ""));
157     }
158 }
159 
160 /**
161  * @tc.name: EventCheckerTest009
162  * @tc.desc: Test isCompliantRule apis of RuleChecker
163  * @tc.type: FUNC
164  * @tc.require: issueIAPJKN
165  */
166 HWTEST_F(EventCheckerTest, EventCheckerTest009, testing::ext::TestSize.Level3)
167 {
168     CompliantEventChecker eventChecker;
169     if (Parameter::GetInteger("const.secure", 1) == 0) { // 1 and 0 is test value
170         ASSERT_TRUE(eventChecker.IsCompliantEvent("STABILITY", "JS_ERROR"));
171     } else {
172         ASSERT_FALSE(eventChecker.IsCompliantEvent("STABILITY", "JS_ERROR"));
173     }
174 }
175 
176 /**
177  * @tc.name: EventCheckerTest010
178  * @tc.desc: Test isCompliantRule apis of RuleChecker
179  * @tc.type: FUNC
180  * @tc.require: issueIAPJKN
181  */
182 HWTEST_F(EventCheckerTest, EventCheckerTest010, testing::ext::TestSize.Level3)
183 {
184     CompliantEventChecker eventChecker;
185     if (Parameter::GetInteger("const.secure", 1) == 0) { // 1 and 0 is test value
186         ASSERT_TRUE(eventChecker.IsCompliantEvent("STABILITY", "JS_ERROR_INVALID"));
187     } else {
188         ASSERT_TRUE(eventChecker.IsCompliantEvent("STABILITY", "JS_ERROR_INVALID"));
189     }
190 }
191 
192 /**
193  * @tc.name: EventCheckerTest011
194  * @tc.desc: Test isCompliantRule apis of RuleChecker
195  * @tc.type: FUNC
196  * @tc.require: issueIAPJKN
197  */
198 HWTEST_F(EventCheckerTest, EventCheckerTest011, testing::ext::TestSize.Level3)
199 {
200     CompliantEventChecker eventChecker;
201     if (Parameter::GetInteger("const.secure", 1) == 0) { // 1 and 0 is test value
202         ASSERT_TRUE(eventChecker.IsCompliantEvent("WORKSCHEDULER", "WORK_ADD"));
203     } else {
204         ASSERT_FALSE(eventChecker.IsCompliantEvent("WORKSCHEDULER", "WORK_ADD"));
205     }
206 }
207 
208 /**
209  * @tc.name: EventCheckerTest012
210  * @tc.desc: Test isCompliantRule apis of RuleChecker
211  * @tc.type: FUNC
212  * @tc.require: issueIAPJKN
213  */
214 HWTEST_F(EventCheckerTest, EventCheckerTest012, testing::ext::TestSize.Level3)
215 {
216     CompliantEventChecker eventChecker;
217     if (Parameter::GetInteger("const.secure", 1) == 0) { // 1 and 0 is test value
218         ASSERT_TRUE(eventChecker.IsCompliantEvent("STABILITY", "WORK_ADD_INVALID"));
219     } else {
220         ASSERT_TRUE(eventChecker.IsCompliantEvent("STABILITY", "WORK_ADD_INVALID"));
221     }
222 }
223 } //
224 } //