• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 #include <sys/stat.h>
18 #include <sys/types.h>
19 #include <string>
20 
21 #include "content_sensor_manager_utils.h"
22 #include "distributed_device_profile_errors.h"
23 #include "static_capability_collector.h"
24 #include "static_capability_loader.h"
25 #include "static_profile_manager.h"
26 #include "profile_cache.h"
27 
28 namespace OHOS {
29 namespace DistributedDeviceProfile {
30 using namespace testing::ext;
31 using namespace std;
32 namespace {
33     const std::string TAG = "StaticCapabilityCollectorTest";
34 }
35 class StaticCapabilityCollectorTest : public testing::Test {
36 public:
37     static void SetUpTestCase();
38     static void TearDownTestCase();
39     void SetUp();
40     void TearDown();
41 };
42 
SetUpTestCase()43 void StaticCapabilityCollectorTest::SetUpTestCase()
44 {
45 }
46 
TearDownTestCase()47 void StaticCapabilityCollectorTest::TearDownTestCase()
48 {
49 }
50 
SetUp()51 void StaticCapabilityCollectorTest::SetUp()
52 {
53 }
54 
TearDown()55 void StaticCapabilityCollectorTest::TearDown()
56 {
57 }
58 
59 /*
60  * @tc.name: Init_001
61  * @tc.desc: Normal testCase of StaticCapabilityCollectorTest
62  * @tc.type: FUNC
63  */
64 HWTEST_F(StaticCapabilityCollectorTest, Init_001, TestSize.Level1)
65 {
66     int32_t ret = OHOS::DistributedDeviceProfile::
67         StaticCapabilityCollector::GetInstance().Init();
68     EXPECT_EQ(ret, DP_SUCCESS);
69 }
70 
71 #ifndef DEVICE_PROFILE_STATIC_DISABLE
72 /*
73  * @tc.name: CollectStaticCapability_001
74  * @tc.desc: Normal testCase of StaticCapabilityCollectorTest
75  * @tc.type: FUNC
76  */
77 HWTEST_F(StaticCapabilityCollectorTest, CollectStaticCapability_001, TestSize.Level1)
78 {
79     int32_t ret = OHOS::DistributedDeviceProfile::
80         StaticCapabilityCollector::GetInstance().CollectStaticCapability();
81     EXPECT_EQ(ret, DP_SUCCESS);
82 }
83 #endif // DEVICE_PROFILE_STATIC_DISABLE
84 
85 /*
86  * @tc.name: UnInit_001
87  * @tc.desc: Normal testCase of StaticCapabilityCollectorTest
88  * @tc.type: FUNC
89  */
90 HWTEST_F(StaticCapabilityCollectorTest, UnInit_001, TestSize.Level1)
91 {
92     int32_t ret = OHOS::DistributedDeviceProfile::
93         StaticCapabilityCollector::GetInstance().UnInit();
94     EXPECT_EQ(ret, DP_SUCCESS);
95 }
96 } // namespace DistributedDeviceProfile
97 } // namespace OHOS
98