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