1 /*
2 * Copyright (c) 2022 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 <gtest/gtest.h>
17
18 #define private public
19 #define protected public
20 #include "hdc_register.h"
21 #undef private
22 #undef protected
23
24 using namespace testing;
25 using namespace testing::ext;
26
27 namespace OHOS {
28 namespace AbilityRuntime {
29 class HdcRegisterTest : public testing::Test {
30 public:
31 static void SetUpTestCase();
32 static void TearDownTestCase();
33 void SetUp() override;
34 void TearDown() override;
35 };
36
SetUpTestCase()37 void HdcRegisterTest::SetUpTestCase()
38 {}
39
TearDownTestCase()40 void HdcRegisterTest::TearDownTestCase()
41 {}
42
SetUp()43 void HdcRegisterTest::SetUp()
44 {}
45
TearDown()46 void HdcRegisterTest::TearDown()
47 {}
48
49 /**
50 * @tc.name: HdcRegisterTest_0100
51 * @tc.desc: HdcRegisterTest Test
52 * @tc.type: FUNC
53 */
54 HWTEST_F(HdcRegisterTest, HdcRegisterTest_0100, TestSize.Level0)
55 {
56 const std::string processName = "";
57 const std::string bundleName = "";
58 bool debugApp = true;
59 auto &pHdcRegister = AbilityRuntime::HdcRegister::Get();
60
61 pHdcRegister.StartHdcRegister(bundleName, processName, debugApp, nullptr);
62
63 EXPECT_TRUE(true);
64 }
65
66 /**
67 * @tc.name: HdcRegisterTest_0200
68 * @tc.desc: HdcRegisterTest Test
69 * @tc.type: FUNC
70 */
71 HWTEST_F(HdcRegisterTest, HdcRegisterTest_0200, TestSize.Level0)
72 {
73 auto &pHdcRegister = AbilityRuntime::HdcRegister::Get();
74 pHdcRegister.registerHandler_ = nullptr;
75 pHdcRegister.StopHdcRegister();
76
77 EXPECT_TRUE(true);
78 }
79
80 /**
81 * @tc.name: HdcRegisterTest_0300
82 * @tc.desc: HdcRegisterTest Test
83 * @tc.type: FUNC
84 */
85 HWTEST_F(HdcRegisterTest, HdcRegisterTest_0300, TestSize.Level0)
86 {
87 const std::string processName = "123";
88 const std::string bundleName = "123";
89 bool debugApp = true;
90 auto &pHdcRegister = AbilityRuntime::HdcRegister::Get();
91 pHdcRegister.StartHdcRegister(bundleName, processName, debugApp, nullptr);
92 pHdcRegister.StopHdcRegister();
93
94 EXPECT_TRUE(true);
95 }
96 } // namespace AbilityRuntime
97 } // namespace OHOS
98