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 <gtest/gtest.h>
17
18 #include "profile_change_notification.h"
19 #include "utils.h"
20
21 namespace OHOS {
22 namespace DeviceProfile {
23 using namespace testing;
24 using namespace testing::ext;
25
26 class ProfileEntryTest : public testing::Test {
27 public:
28 static void SetUpTestCase();
29 static void TearDownTestCase();
30 void SetUp();
31 void TearDown();
32 };
33
SetUpTestCase()34 void ProfileEntryTest::SetUpTestCase()
35 {
36 DTEST_LOG << "SetUpTestCase" << std::endl;
37 }
38
TearDownTestCase()39 void ProfileEntryTest::TearDownTestCase()
40 {
41 DTEST_LOG << "TearDownTestCase" << std::endl;
42 }
43
SetUp()44 void ProfileEntryTest::SetUp()
45 {
46 DTEST_LOG << "SetUp" << std::endl;
47 }
48
TearDown()49 void ProfileEntryTest::TearDown()
50 {
51 DTEST_LOG << "TearDown" << std::endl;
52 }
53
54 /**
55 * @tc.name: Marshalling_001
56 * @tc.desc: Marshalling of profile entry
57 * @tc.type: FUNC
58 * @tc.require: I4NY1T
59 */
60 HWTEST_F(ProfileEntryTest, Marshalling_001, TestSize.Level3)
61 {
62 Parcel parcel;
63 std::shared_ptr<ProfileEntry> temp = std::make_shared<ProfileEntry>();
64 bool result = temp->Marshalling(parcel);
65 EXPECT_EQ(true, result);
66 }
67
68 /**
69 * @tc.name: Unmarshalling_001
70 * @tc.desc: Unmarshalling of profile entry
71 * @tc.type: FUNC
72 * @tc.require: I4NY1T
73 */
74 HWTEST_F(ProfileEntryTest, Unmarshalling_001, TestSize.Level3)
75 {
76 Parcel parcel;
77 std::shared_ptr<ProfileEntry> temp = std::make_shared<ProfileEntry>();
78 bool result = temp->Unmarshalling(parcel);
79 EXPECT_EQ(false, result);
80 }
81
82 /**
83 * @tc.name: Unmarshalling_002
84 * @tc.desc: Unmarshalling of profile entry
85 * @tc.type: FUNC
86 * @tc.require: I4NY1T
87 */
88 HWTEST_F(ProfileEntryTest, Unmarshalling_002, TestSize.Level3)
89 {
90 Parcel parcel;
91 std::shared_ptr<ProfileEntry> temp = std::make_shared<ProfileEntry>();
92 bool result = temp->Marshalling(parcel);
93 EXPECT_EQ(true, result);
94 result = temp->Unmarshalling(parcel);
95 EXPECT_EQ(true, result);
96 }
97 }
98 }