• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  *
4  * HDF is dual licensed: you can use it either under the terms of
5  * the GPL, or the BSD license, at your option.
6  * See the LICENSE file in the root of this repository for complete details.
7  */
8 
9 #include <cstdint>
10 #include <cstdio>
11 #include <cstdlib>
12 #include <fcntl.h>
13 #include <string>
14 #include <unistd.h>
15 #include <gtest/gtest.h>
16 #include "hdf_uhdf_test.h"
17 #include "platform_event_test.h"
18 
19 using namespace testing::ext;
20 
21 class HdfPlatformEventTest : public testing::Test {
22 public:
23     static void SetUpTestCase();
24     static void TearDownTestCase();
25     void SetUp();
26     void TearDown();
27 };
28 
SetUpTestCase()29 void HdfPlatformEventTest::SetUpTestCase()
30 {
31     HdfTestOpenService();
32 }
33 
TearDownTestCase()34 void HdfPlatformEventTest::TearDownTestCase()
35 {
36     HdfTestCloseService();
37 }
38 
SetUp()39 void HdfPlatformEventTest::SetUp()
40 {
41 }
42 
TearDown()43 void HdfPlatformEventTest::TearDown()
44 {
45 }
46 
47 /**
48   * @tc.name: HdfPlatformEventTestInitAndUninit001
49   * @tc.desc: platform event function test
50   * @tc.type: FUNC
51   * @tc.require: NA
52   */
53 HWTEST_F(HdfPlatformEventTest, HdfPlatformEventTestInitAndUninit001, TestSize.Level1)
54 {
55     struct HdfTestMsg msg = {TEST_PAL_EVENT_TYPE, PLAT_EVENT_TEST_INIT_AND_UNINIT, -1};
56     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
57 }
58 
59 /**
60   * @tc.name: HdfPlatformEventTestPostAndWait001
61   * @tc.desc: platform event function test
62   * @tc.type: FUNC
63   * @tc.require: NA
64   */
65 HWTEST_F(HdfPlatformEventTest, HdfPlatformEventTestPostAndWait001, TestSize.Level1)
66 {
67     struct HdfTestMsg msg = {TEST_PAL_EVENT_TYPE, PLAT_EVENT_TEST_POST_AND_WAIT, -1};
68     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
69 }
70 
71 /**
72   * @tc.name: HdfPlatformEventTestListenAndUnlisten001
73   * @tc.desc: platform event function test
74   * @tc.type: FUNC
75   * @tc.require: NA
76   */
77 HWTEST_F(HdfPlatformEventTest, HdfPlatformEventTestListenAndUnlisten001, TestSize.Level1)
78 {
79     struct HdfTestMsg msg = {TEST_PAL_EVENT_TYPE, PLAT_EVENT_TEST_LISTEN_AND_UNLISTEN, -1};
80     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
81 }
82 
83 /**
84   * @tc.name: HdfPlatformEventTestReliability001
85   * @tc.desc: platform event function test
86   * @tc.type: FUNC
87   * @tc.require: NA
88   */
89 HWTEST_F(HdfPlatformEventTest, HdfPlatformEventTestReliability001, TestSize.Level1)
90 {
91     struct HdfTestMsg msg = {TEST_PAL_EVENT_TYPE, PLAT_EVENT_TEST_RELIABILITY, -1};
92     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
93 }
94 
95