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 #include "common_event_subscribe_info.h"
18 
19 namespace OHOS {
20 namespace EventFwk {
CommonEventSubscribeInfo(const MatchingSkills & matchingSkills)21 CommonEventSubscribeInfo::CommonEventSubscribeInfo(const MatchingSkills& matchingSkills)
22     : matchingSkills_(matchingSkills), priority_(0), threadMode_(CommonEventSubscribeInfo::ASYNC)
23 {}
24 
CommonEventSubscribeInfo()25 CommonEventSubscribeInfo::CommonEventSubscribeInfo() : priority_(0), threadMode_(CommonEventSubscribeInfo::ASYNC)
26 {}
27 
CommonEventSubscribeInfo(const CommonEventSubscribeInfo & commonEventSubscribeInfo)28 CommonEventSubscribeInfo::CommonEventSubscribeInfo(const CommonEventSubscribeInfo& commonEventSubscribeInfo)
29 {
30     GTEST_LOG_(INFO) << "MOCK CommonEventSubscribeInfo CommonEventSubscribeInfo";
31     matchingSkills_ = commonEventSubscribeInfo.matchingSkills_;
32     priority_ = commonEventSubscribeInfo.priority_;
33     permission_ = commonEventSubscribeInfo.permission_;
34     deviceId_ = commonEventSubscribeInfo.deviceId_;
35     threadMode_ = commonEventSubscribeInfo.threadMode_;
36 }
37 
~CommonEventSubscribeInfo()38 CommonEventSubscribeInfo::~CommonEventSubscribeInfo()
39 {}
40 
SetPriority(const int32_t & priority)41 void CommonEventSubscribeInfo::SetPriority(const int32_t& priority)
42 {
43     GTEST_LOG_(INFO) << "MOCK CommonEventSubscribeInfo SetPriority";
44     priority_ = priority;
45 }
46 
GetPriority() const47 int32_t CommonEventSubscribeInfo::GetPriority() const
48 {
49     GTEST_LOG_(INFO) << "MOCK CommonEventSubscribeInfo GetPriority";
50     return priority_;
51 }
52 
SetPermission(const std::string & permission)53 void CommonEventSubscribeInfo::SetPermission(const std::string& permission)
54 {
55     GTEST_LOG_(INFO) << "MOCK CommonEventSubscribeInfo SetPermission";
56     permission_ = permission;
57 }
58 
GetPermission() const59 std::string CommonEventSubscribeInfo::GetPermission() const
60 {
61     GTEST_LOG_(INFO) << "MOCK CommonEventSubscribeInfo GetPermission";
62     return permission_;
63 }
64 
GetThreadMode() const65 CommonEventSubscribeInfo::ThreadMode CommonEventSubscribeInfo::GetThreadMode() const
66 {
67     GTEST_LOG_(INFO) << "MOCK CommonEventSubscribeInfo GetThreadMode";
68     return threadMode_;
69 }
70 
SetThreadMode(CommonEventSubscribeInfo::ThreadMode threadMode)71 void CommonEventSubscribeInfo::SetThreadMode(CommonEventSubscribeInfo::ThreadMode threadMode)
72 {
73     GTEST_LOG_(INFO) << "MOCK CommonEventSubscribeInfo SetThreadMode";
74     threadMode_ = threadMode;
75 }
76 
SetDeviceId(const std::string & deviceId)77 void CommonEventSubscribeInfo::SetDeviceId(const std::string& deviceId)
78 {
79     GTEST_LOG_(INFO) << "MOCK CommonEventSubscribeInfo SetDeviceId";
80     deviceId_ = deviceId;
81 }
82 
GetDeviceId() const83 std::string CommonEventSubscribeInfo::GetDeviceId() const
84 {
85     GTEST_LOG_(INFO) << "MOCK CommonEventSubscribeInfo GetDeviceId";
86     return deviceId_;
87 }
88 
GetMatchingSkills() const89 const MatchingSkills& CommonEventSubscribeInfo::GetMatchingSkills() const
90 {
91     GTEST_LOG_(INFO) << "MOCK CommonEventSubscribeInfo GetMatchingSkills";
92     return matchingSkills_;
93 }
94 
Marshalling(Parcel & parcel) const95 bool CommonEventSubscribeInfo::Marshalling(Parcel& parcel) const
96 {
97     (void)parcel;
98     return true;
99 }
100 
ReadFromParcel(Parcel & parcel)101 bool CommonEventSubscribeInfo::ReadFromParcel(Parcel& parcel)
102 {
103     (void)parcel;
104     return true;
105 }
106 
Unmarshalling(Parcel & parcel)107 CommonEventSubscribeInfo* CommonEventSubscribeInfo::Unmarshalling(Parcel& parcel)
108 {
109     (void)parcel;
110     CommonEventSubscribeInfo* commonEventSubscribeInfo = new CommonEventSubscribeInfo();
111     return commonEventSubscribeInfo;
112 }
113 } // namespace EventFwk
114 } // namespace OHOS