1 /*
2 * Copyright (C) 2021–2022 Beijing OSWare Technology Co., Ltd
3 * This file contains confidential and proprietary information of
4 * OSWare Technology Co., Ltd
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19 #include <cstdint>
20 #include <cstdio>
21 #include <cstdlib>
22 #include <fcntl.h>
23 #include <string>
24 #include <unistd.h>
25 #include <gtest/gtest.h>
26 #include "hdf_uhdf_test.h"
27 #include "hdf_io_service_if.h"
28 #include "watchdog_test.h"
29
30 using namespace testing::ext;
31
32 class HdfLiteWatchdogTest : public testing::Test {
33 public:
34 static void SetUpTestCase();
35 static void TearDownTestCase();
36 void SetUp();
37 void TearDown();
38 };
39
SetUpTestCase()40 void HdfLiteWatchdogTest::SetUpTestCase()
41 {
42 HdfTestOpenService();
43 }
44
TearDownTestCase()45 void HdfLiteWatchdogTest::TearDownTestCase()
46 {
47 HdfTestCloseService();
48 }
49
SetUp()50 void HdfLiteWatchdogTest::SetUp()
51 {
52 }
53
TearDown()54 void HdfLiteWatchdogTest::TearDown()
55 {
56 }
57
58 /**
59 * @tc.name: HdfLiteWatchdogTestSetGetTimeout001
60 * @tc.desc: watchdog function test
61 * @tc.type: FUNC
62 * @tc.require: AR000F868G
63 */
64 HWTEST_F(HdfLiteWatchdogTest, HdfLiteWatchdogTestSetGetTimeout001, TestSize.Level1)
65 {
66 struct HdfTestMsg msg = {TEST_PAL_WDT_TYPE, WATCHDOG_TEST_SET_GET_TIMEOUT, -1};
67 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
68 }
69
70 /**
71 * @tc.name: HdfLiteWatchdogTestStartStop001
72 * @tc.desc: watchdog function test
73 * @tc.type: FUNC
74 * @tc.require: AR000F868G
75 */
76 HWTEST_F(HdfLiteWatchdogTest, HdfLiteWatchdogTestStartStop001, TestSize.Level1)
77 {
78 struct HdfTestMsg msg = {TEST_PAL_WDT_TYPE, WATCHDOG_TEST_START_STOP, -1};
79 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
80 }
81
82 /**
83 * @tc.name: HdfLiteWatchdogTestFeed001
84 * @tc.desc: watchdog function test
85 * @tc.type: FUNC
86 * @tc.require: AR000F868G
87 */
88 HWTEST_F(HdfLiteWatchdogTest, HdfLiteWatchdogTestFeed001, TestSize.Level1)
89 {
90 struct HdfTestMsg msg = {TEST_PAL_WDT_TYPE, WATCHDOG_TEST_FEED, -1};
91 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
92 }
93
94 /**
95 * @tc.name: HdfLiteWatchdogTestReliability001
96 * @tc.desc: watchdog function test
97 * @tc.type: FUNC
98 * @tc.require: AR000F868G
99 */
100 HWTEST_F(HdfLiteWatchdogTest, HdfLiteWatchdogTestReliability001, TestSize.Level1)
101 {
102 struct HdfTestMsg msg = {TEST_PAL_WDT_TYPE, WATCHDOG_TEST_RELIABILITY, -1};
103 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
104 }
105
106