• 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_device_test.h"
18 
19 using namespace testing::ext;
20 
21 class HdfPlatformDeviceTest : public testing::Test {
22 public:
23     static void SetUpTestCase();
24     static void TearDownTestCase();
25     void SetUp();
26     void TearDown();
27 };
28 
SetUpTestCase()29 void HdfPlatformDeviceTest::SetUpTestCase()
30 {
31     HdfTestOpenService();
32 }
33 
TearDownTestCase()34 void HdfPlatformDeviceTest::TearDownTestCase()
35 {
36     HdfTestCloseService();
37 }
38 
SetUp()39 void HdfPlatformDeviceTest::SetUp()
40 {
41 }
42 
TearDown()43 void HdfPlatformDeviceTest::TearDown()
44 {
45 }
46 
47 /**
48   * @tc.name: HdfPlatformDeviceTestSetName001
49   * @tc.desc: platform device function test
50   * @tc.type: FUNC
51   * @tc.require: NA
52   */
53 HWTEST_F(HdfPlatformDeviceTest, HdfPlatformDeviceTestSetName001, TestSize.Level1)
54 {
55     struct HdfTestMsg msg = {TEST_PAL_DEVICE_TYPE, PLAT_DEVICE_TEST_SET_NAME, -1};
56     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
57 }
58 
59 /**
60   * @tc.name: HdfPlatformDeviceTestGetDevice001
61   * @tc.desc: platform device function test
62   * @tc.type: FUNC
63   * @tc.require: NA
64   */
65 HWTEST_F(HdfPlatformDeviceTest, HdfPlatformDeviceTestGetDevice001, TestSize.Level1)
66 {
67     struct HdfTestMsg msg = {TEST_PAL_DEVICE_TYPE, PLAT_DEVICE_TEST_GET_DEVICE, -1};
68     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
69 }
70 
71 /**
72   * @tc.name: HdfPlatformDeviceTestWaitEvent001
73   * @tc.desc: platform device function test
74   * @tc.type: FUNC
75   * @tc.require: NA
76   */
77 HWTEST_F(HdfPlatformDeviceTest, HdfPlatformDeviceTestWaitEvent001, TestSize.Level1)
78 {
79     struct HdfTestMsg msg = {TEST_PAL_DEVICE_TYPE, PLAT_DEVICE_TEST_WAIT_EVENT, -1};
80     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
81 }
82 
83 /**
84   * @tc.name: HdfPlatformDeviceTestAddDevice001
85   * @tc.desc: platform device function test
86   * @tc.type: FUNC
87   * @tc.require: NA
88   */
89 HWTEST_F(HdfPlatformDeviceTest, HdfPlatformDeviceTestAddDevice001, TestSize.Level1)
90 {
91     struct HdfTestMsg msg = {TEST_PAL_DEVICE_TYPE, PLAT_DEVICE_TEST_ADD_DEVICE, -1};
92     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
93 }
94 
95 /**
96   * @tc.name: HdfPlatformDeviceTestCreateService001
97   * @tc.desc: platform device function test
98   * @tc.type: FUNC
99   * @tc.require: NA
100   */
101 HWTEST_F(HdfPlatformDeviceTest, HdfPlatformDeviceTestCreateService001, TestSize.Level1)
102 {
103     struct HdfTestMsg msg = {TEST_PAL_DEVICE_TYPE, PLAT_DEVICE_TEST_CREATE_SERVICE, -1};
104     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
105 }
106 
107 /**
108   * @tc.name: HdfPlatformDeviceTestBindDevice001
109   * @tc.desc: platform device function test
110   * @tc.type: FUNC
111   * @tc.require: NA
112   */
113 HWTEST_F(HdfPlatformDeviceTest, HdfPlatformDeviceTestBindDevice001, TestSize.Level1)
114 {
115     struct HdfTestMsg msg = {TEST_PAL_DEVICE_TYPE, PLAT_DEVICE_TEST_BIND_DEVICE, -1};
116     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
117 }
118 
119 /**
120   * @tc.name: HdfPlatformDeviceTestReliability001
121   * @tc.desc: platform device function test
122   * @tc.type: FUNC
123   * @tc.require: NA
124   */
125 HWTEST_F(HdfPlatformDeviceTest, HdfPlatformDeviceTestReliability001, TestSize.Level1)
126 {
127     struct HdfTestMsg msg = {TEST_PAL_DEVICE_TYPE, PLAT_DEVICE_TEST_RELIABILITY, -1};
128     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
129 }
130