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_manager_test.h"
18
19 using namespace testing::ext;
20
21 class HdfPlatformManagerTest : public testing::Test {
22 public:
23 static void SetUpTestCase();
24 static void TearDownTestCase();
25 void SetUp();
26 void TearDown();
27 };
28
SetUpTestCase()29 void HdfPlatformManagerTest::SetUpTestCase()
30 {
31 HdfTestOpenService();
32 }
33
TearDownTestCase()34 void HdfPlatformManagerTest::TearDownTestCase()
35 {
36 HdfTestCloseService();
37 }
38
SetUp()39 void HdfPlatformManagerTest::SetUp()
40 {
41 }
42
TearDown()43 void HdfPlatformManagerTest::TearDown()
44 {
45 }
46
47 /**
48 * @tc.name: HdfPlatformManagerTestAddDevice001
49 * @tc.desc: platform manager function test
50 * @tc.type: FUNC
51 * @tc.require: NA
52 */
53 HWTEST_F(HdfPlatformManagerTest, HdfPlatformManagerTestAddDevice001, TestSize.Level1)
54 {
55 struct HdfTestMsg msg = {TEST_PAL_MANAGER_TYPE, PLAT_MANAGER_TEST_ADD_DEVICE, -1};
56 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
57 }
58
59 /**
60 * @tc.name: HdfPlatformManagerTestGetDevice001
61 * @tc.desc: platform manager function test
62 * @tc.type: FUNC
63 * @tc.require: NA
64 */
65 HWTEST_F(HdfPlatformManagerTest, HdfPlatformManagerTestGetDevice001, TestSize.Level1)
66 {
67 struct HdfTestMsg msg = {TEST_PAL_MANAGER_TYPE, PLAT_MANAGER_TEST_GET_DEVICE, -1};
68 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
69 }
70
71 /**
72 * @tc.name: HdfPlatformManagerTestReliability001
73 * @tc.desc: platform manager function test
74 * @tc.type: FUNC
75 * @tc.require: NA
76 */
77 HWTEST_F(HdfPlatformManagerTest, HdfPlatformManagerTestReliability001, TestSize.Level1)
78 {
79 struct HdfTestMsg msg = {TEST_PAL_MANAGER_TYPE, PLAT_MANAGER_TEST_RELIABILITY, -1};
80 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
81 }
82
83