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 "UTTest_multiple_user_connector.h"
17 
18 #include "dm_constants.h"
19 #include "multiple_user_connector.h"
20 
21 namespace OHOS {
22 namespace DistributedHardware {
SetUp()23 void MultipleUserConnectorTest::SetUp()
24 {
25 }
TearDown()26 void MultipleUserConnectorTest::TearDown()
27 {
28 }
SetUpTestCase()29 void MultipleUserConnectorTest::SetUpTestCase()
30 {
31 }
TearDownTestCase()32 void MultipleUserConnectorTest::TearDownTestCase()
33 {
34 }
35 
36 namespace {
37 /**
38  * @tc.name: OnDecisionFilterResult_001
39  * @tc.desc:  Returns a new pointer to the constructor
40  * to construct an environment where the device has been discovered, and stop discovering
41  * the device. Its return value is ERR_DM_INPUT_PARA_INVALID
42  * @tc.type: FUNC
43  * @tc.require: AR000GHSJK
44  */
45 HWTEST_F(MultipleUserConnectorTest, GetCurrentAccountUserID_001, testing::ext::TestSize.Level0)
46 {
47     int32_t ret = DM_OK;
48     ret = MultipleUserConnector::GetCurrentAccountUserID();
49     ASSERT_EQ(ret, DM_OK);
50 }
51 
52 /**
53  * @tc.name: SetSwitchOldUserId_001
54  * @tc.desc:  Returns a new pointer to the constructor
55  * to construct an environment where the device has been discovered, and stop discovering
56  * the device. Its return value is ERR_DM_INPUT_PARA_INVALID
57  * @tc.type: FUNC
58  * @tc.require: AR000GHSJK
59  */
60 HWTEST_F(MultipleUserConnectorTest, SetSwitchOldUserId_001, testing::ext::TestSize.Level0)
61 {
62     int32_t userIdIn = 1234;
63     int32_t userIdOut = -1;
64     MultipleUserConnector::SetSwitchOldUserId(userIdIn);
65     userIdOut = MultipleUserConnector::GetSwitchOldUserId();
66     ASSERT_EQ(userIdIn, userIdOut);
67 }
68 
69 /**
70  * @tc.name: GetSwitchOldUserId_001
71  * @tc.desc:  Returns a new pointer to the constructor
72  * to construct an environment where the device has been discovered, and stop discovering
73  * the device. Its return value is ERR_DM_INPUT_PARA_INVALID
74  * @tc.type: FUNC
75  * @tc.require: AR000GHSJK
76  */
77 HWTEST_F(MultipleUserConnectorTest, GetSwitchOldUserId_001, testing::ext::TestSize.Level0)
78 {
79     int32_t userIdIn = 1234;
80     int32_t userIdOut = -1;
81     MultipleUserConnector::SetSwitchOldUserId(userIdIn);
82     userIdOut = MultipleUserConnector::GetSwitchOldUserId();
83     ASSERT_EQ(userIdIn, userIdOut);
84 }
85 }
86 } // namespace DistributedHardware
87 } // namespace OHOS
88