1 /*
2 * Copyright (c) 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 "ipc_full_test.h"
17
18 #include "ipc_full.h"
19
20 using namespace testing::ext;
21
22 namespace OHOS {
23 namespace HiviewDFX {
SetUpTestCase(void)24 void IpcFullTest::SetUpTestCase(void)
25 {
26 }
27
TearDownTestCase(void)28 void IpcFullTest::TearDownTestCase(void)
29 {
30 }
31
SetUp(void)32 void IpcFullTest::SetUp(void)
33 {
34 }
35
TearDown(void)36 void IpcFullTest::TearDown(void)
37 {
38 }
39
40 /**
41 * @tc.name: AddIpcFullTest
42 * @tc.desc: Verify add ipc full interface
43 * @tc.type: FUNC
44 * @tc.require: AR20250307218293
45 * @tc.author: zhengchengkai
46 */
47 HWTEST_F(IpcFullTest, AddIpcFullTest_001, TestSize.Level1)
48 {
49 /**
50 * @tc.steps: step1. input interval param below the min allowable threshold
51 * @tc.expected: step1. add ipc full failed;
52 */
53 bool result = IpcFull::GetInstance().AddIpcFull(4);
54 ASSERT_EQ(result, false);
55
56 /**
57 * @tc.steps: step2. input interval param above the max allowable threshold
58 * @tc.expected: step2. add ipc full failed;
59 */
60 result = IpcFull::GetInstance().AddIpcFull(32);
61 ASSERT_EQ(result, false);
62
63 /**
64 * @tc.steps: step3. input valid interval param
65 * @tc.expected: step3. add ipc full successfully;
66 */
67 result = IpcFull::GetInstance().AddIpcFull(12);
68 ASSERT_EQ(result, true);
69
70 /**
71 * @tc.steps: step4. ipc full task already exists
72 * @tc.expected: step4. add ipc full failed;
73 */
74 result = IpcFull::GetInstance().AddIpcFull(12);
75 ASSERT_EQ(result, false);
76 }
77 } // namespace HiviewDFX
78 } // namespace OHOS
79