• 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 #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  * @tc.require:
51  * @tc.author: SQL
52  */
53 HWTEST_F(DevManagerMockTest, GetUnEncryptedUuid001, TestSize.Level1)
54 {
55     ZLOGI("GetUnEncryptedUuid001 begin.");
56     auto uuid = DevManager::GetInstance().GetUnEncryptedUuid();
57     EXPECT_EQ(uuid, "");
58 }
59 
60 /**
61  * @tc.name: GetUnEncryptedUuid
62  * @tc.desc: test GetUnEncryptedUuid networkid empty
63  * @tc.type: FUNC
64  * @tc.require:
65  * @tc.author: SQL
66  */
67 HWTEST_F(DevManagerMockTest, GetUnEncryptedUuid002, TestSize.Level1)
68 {
69     ZLOGI("GetUnEncryptedUuid002 begin.");
70     auto uuid = DevManager::GetInstance().GetUnEncryptedUuid();
71     EXPECT_EQ(uuid, "");
72 }
73 
74 /**
75  * @tc.name: GetLocalDevice
76  * @tc.desc: test GetLocalDevice get local device info fail
77  * @tc.type: FUNC
78  * @tc.require:
79  * @tc.author: SQL
80  */
81 HWTEST_F(DevManagerMockTest, GetLocalDevice, TestSize.Level1)
82 {
83     ZLOGI("GetLocalDevice begin.");
84     auto devInfo = DevManager::GetInstance().GetLocalDevice();
85     EXPECT_EQ(devInfo.uuid, "");
86 }
87 
88 /**
89  * @tc.name: GetRemoteDevices001
90  * @tc.desc: test GetRemoteDevices get trusted device fail
91  * @tc.type: FUNC
92  * @tc.require:
93  * @tc.author: SQL
94  */
95 HWTEST_F(DevManagerMockTest, GetRemoteDevices001, TestSize.Level1)
96 {
97     ZLOGI("GetRemoteDevices001 begin.");
98     auto detailInfo = DevManager::GetInstance().GetRemoteDevices();
99     EXPECT_TRUE(detailInfo.empty());
100 }
101 
102 /**
103  * @tc.name: GetRemoteDevices002
104  * @tc.desc: test GetRemoteDevices get trusted device no remote device
105  * @tc.type: FUNC
106  * @tc.require:
107  * @tc.author: SQL
108  */
109 HWTEST_F(DevManagerMockTest, GetRemoteDevices002, TestSize.Level1)
110 {
111     ZLOGI("GetRemoteDevices002 begin.");
112     auto detailInfo = DevManager::GetInstance().GetRemoteDevices();
113     EXPECT_TRUE(detailInfo.empty());
114 }
115 } // namespace OHOS::Test