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 #define LOG_TAG "DevManagerMockTest"
17 #include "dev_manager.h"
18 #include "device_manager_mock.h"
19 #include "log_print.h"
20 #include "types.h"
21 #include <gtest/gtest.h>
22 namespace OHOS::Test {
23 using namespace testing;
24 using namespace testing::ext;
25 using namespace OHOS;
26 using namespace OHOS::DistributedKv;
27 using namespace OHOS::DistributedHardware;
28 using DmDeviceInfo = OHOS::DistributedHardware::DmDeviceInfo;
29 class DevManagerMockTest : public testing::Test {
30 public:
31 static void SetUpTestCase(void);
32 static void TearDownTestCase(void);
33
34 void SetUp();
35 void TearDown();
36 };
37
SetUpTestCase(void)38 void DevManagerMockTest::SetUpTestCase(void) { }
39
TearDownTestCase(void)40 void DevManagerMockTest::TearDownTestCase(void) { }
41
SetUp(void)42 void DevManagerMockTest::SetUp(void) { }
43
TearDown(void)44 void DevManagerMockTest::TearDown(void) { }
45
46 /**
47 * @tc.name: GetUnEncryptedUuid
48 * @tc.desc: test GetUnEncryptedUuid get local device info fail
49 * @tc.type: FUNC
50 */
51 HWTEST_F(DevManagerMockTest, GetUnEncryptedUuid001, TestSize.Level1)
52 {
53 ZLOGI("GetUnEncryptedUuid001 begin.");
54 auto uuid = DevManager::GetInstance().GetUnEncryptedUuid();
55 EXPECT_EQ(uuid, "");
56 }
57
58 /**
59 * @tc.name: GetUnEncryptedUuid
60 * @tc.desc: test GetUnEncryptedUuid networkid empty
61 * @tc.type: FUNC
62 */
63 HWTEST_F(DevManagerMockTest, GetUnEncryptedUuid002, TestSize.Level1)
64 {
65 ZLOGI("GetUnEncryptedUuid002 begin.");
66 auto uuid = DevManager::GetInstance().GetUnEncryptedUuid();
67 EXPECT_EQ(uuid, "");
68 }
69
70 /**
71 * @tc.name: GetLocalDevice
72 * @tc.desc: test GetLocalDevice get local device info fail
73 * @tc.type: FUNC
74 */
75 HWTEST_F(DevManagerMockTest, GetLocalDevice, TestSize.Level1)
76 {
77 ZLOGI("GetLocalDevice begin.");
78 auto devInfo = DevManager::GetInstance().GetLocalDevice();
79 EXPECT_EQ(devInfo.uuid, "");
80 }
81
82 /**
83 * @tc.name: GetRemoteDevices001
84 * @tc.desc: test GetRemoteDevices get trusted device fail
85 * @tc.type: FUNC
86 */
87 HWTEST_F(DevManagerMockTest, GetRemoteDevices001, TestSize.Level1)
88 {
89 ZLOGI("GetRemoteDevices001 begin.");
90 auto detailInfo = DevManager::GetInstance().GetRemoteDevices();
91 EXPECT_TRUE(detailInfo.empty());
92 }
93
94 /**
95 * @tc.name: GetRemoteDevices002
96 * @tc.desc: test GetRemoteDevices get trusted device no remote device
97 * @tc.type: FUNC
98 */
99 HWTEST_F(DevManagerMockTest, GetRemoteDevices002, TestSize.Level1)
100 {
101 ZLOGI("GetRemoteDevices002 begin.");
102 auto detailInfo = DevManager::GetInstance().GetRemoteDevices();
103 EXPECT_TRUE(detailInfo.empty());
104 }
105 } // namespace OHOS::Test