• 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 "enabled_comps_dump_test.h"
17 
18 #include <mutex>
19 #include <set>
20 #include <string>
21 
22 #define private public
23 #include "enabled_comps_dump.h"
24 #undef private
25 
26 using namespace testing::ext;
27 namespace OHOS {
28 namespace DistributedHardware {
SetUpTestCase(void)29 void EnabledCompsDumpTest::SetUpTestCase(void) {}
30 
TearDownTestCase(void)31 void EnabledCompsDumpTest::TearDownTestCase(void) {}
32 
SetUp()33 void EnabledCompsDumpTest::SetUp() {}
34 
TearDown()35 void EnabledCompsDumpTest::TearDown() {}
36 
37 /**
38  * @tc.name: DumpEnabledComp_001
39  * @tc.desc: Verify the DumpEnabledComp function
40  * @tc.type: FUNC
41  * @tc.require: AR000GHSJM
42  */
43 HWTEST_F(EnabledCompsDumpTest, DumpEnabledComp_001, TestSize.Level0)
44 {
45     std::string networkId;
46     DHType dhType = DHType::CAMERA;
47     std::string dhId;
48     EnabledCompsDump::GetInstance().DumpEnabledComp(networkId, dhType, dhId);
49     EXPECT_EQ(false, EnabledCompsDump::GetInstance().compInfoSet_.empty());
50 }
51 
52 /**
53  * @tc.name: DumpDisabledComp_001
54  * @tc.desc: Verify the DumpDisabledComp function
55  * @tc.type: FUNC
56  * @tc.require: AR000GHSJM
57  */
58 HWTEST_F(EnabledCompsDumpTest, DumpDisabledComp_001, TestSize.Level0)
59 {
60     std::string networkId;
61     DHType dhType = DHType::CAMERA;
62     std::string dhId;
63     EnabledCompsDump::GetInstance().DumpEnabledComp(networkId, dhType, dhId);
64     EXPECT_EQ(false, EnabledCompsDump::GetInstance().compInfoSet_.empty());
65 }
66 
67 /**
68  * @tc.name: Dump_001
69  * @tc.desc: Verify the Dump function
70  * @tc.type: FUNC
71  * @tc.require: AR000GHSJM
72  */
73 HWTEST_F(EnabledCompsDumpTest, Dump_001, TestSize.Level0)
74 {
75     std::set<HidumpCompInfo> compInfoSet;
76     EnabledCompsDump::GetInstance().Dump(compInfoSet);
77     EXPECT_EQ(false, EnabledCompsDump::GetInstance().compInfoSet_.empty());
78 }
79 } // namespace DistributedHardware
80 } // namespace OHOS
81