• 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 
18 #include "device_profile.h"
19 
20 using namespace testing::ext;
21 namespace OHOS {
22 namespace DistributedDeviceProfile {
23 class DeviceProfileTest : public testing::Test {
24 public:
25     static void SetUpTestCase();
26     static void TearDownTestCase();
27     void SetUp();
28     void TearDown();
29 };
30 
SetUpTestCase()31 void DeviceProfileTest::SetUpTestCase()
32 {
33 }
34 
TearDownTestCase()35 void DeviceProfileTest::TearDownTestCase()
36 {
37 }
38 
SetUp()39 void DeviceProfileTest::SetUp()
40 {
41 }
42 
TearDown()43 void DeviceProfileTest::TearDown()
44 {
45 }
46 
47 HWTEST_F(DeviceProfileTest, Marshalling_001, TestSize.Level0)
48 {
49     DeviceProfile deviceProfile;
50     MessageParcel parcel;
51     auto result = deviceProfile.Marshalling(parcel);
52     EXPECT_EQ(true, result);
53 }
54 
55 HWTEST_F(DeviceProfileTest, UnMarshalling_001, TestSize.Level0)
56 {
57     DeviceProfile deviceProfile;
58     MessageParcel parcel;
59     auto result = deviceProfile.UnMarshalling(parcel);
60     EXPECT_EQ(false, result);
61 }
62 
63 HWTEST_F(DeviceProfileTest, dump_001, TestSize.Level0)
64 {
65     DeviceProfile deviceProfile;
66     auto result = deviceProfile.dump();
67     EXPECT_NE(0, result.length());
68 }
69 
70 HWTEST_F(DeviceProfileTest, IsMultiUser_001, TestSize.Level0)
71 {
72     DeviceProfile deviceProfile;
73     deviceProfile.isMultiUser_ = true;
74     auto result = deviceProfile.IsMultiUser();
75     EXPECT_EQ(true, result);
76 }
77 
78 HWTEST_F(DeviceProfileTest, SetIsMultiUser_001, TestSize.Level0)
79 {
80     DeviceProfile deviceProfile;
81     bool isMultiUser = true;
82     deviceProfile.SetIsMultiUser(isMultiUser);
83     auto result = deviceProfile.isMultiUser_;
84     EXPECT_EQ(result, true);
85 }
86 
87 HWTEST_F(DeviceProfileTest, GetUserId_001, TestSize.Level0)
88 {
89     DeviceProfile deviceProfile;
90     deviceProfile.userId_ = 0;
91     auto result = deviceProfile.GetUserId();
92     EXPECT_EQ(0, result);
93 }
94 
95 HWTEST_F(DeviceProfileTest, SetUserId_001, TestSize.Level0)
96 {
97     DeviceProfile deviceProfile;
98     int32_t userId = 1;
99     deviceProfile.SetUserId(userId);
100     auto result = deviceProfile.userId_;
101     EXPECT_EQ(1, result);
102 }
103 }
104 }
105