• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     (void)matchingSkills;
25 }
26 
CommonEventSubscribeInfo()27 CommonEventSubscribeInfo::CommonEventSubscribeInfo() : priority_(0), threadMode_(CommonEventSubscribeInfo::ASYNC)
28 {}
29 
CommonEventSubscribeInfo(const CommonEventSubscribeInfo & commonEventSubscribeInfo)30 CommonEventSubscribeInfo::CommonEventSubscribeInfo(const CommonEventSubscribeInfo& commonEventSubscribeInfo)
31 {
32     matchingSkills_ = commonEventSubscribeInfo.matchingSkills_;
33     priority_ = commonEventSubscribeInfo.priority_;
34     permission_ = commonEventSubscribeInfo.permission_;
35     deviceId_ = commonEventSubscribeInfo.deviceId_;
36     threadMode_ = commonEventSubscribeInfo.threadMode_;
37 }
38 
~CommonEventSubscribeInfo()39 CommonEventSubscribeInfo::~CommonEventSubscribeInfo()
40 {}
41 
SetPriority(const int32_t & priority)42 void CommonEventSubscribeInfo::SetPriority(const int32_t& priority)
43 {
44     priority_ = priority;
45 }
46 
GetPriority() const47 int32_t CommonEventSubscribeInfo::GetPriority() const
48 {
49     return priority_;
50 }
51 
SetPermission(const std::string & permission)52 void CommonEventSubscribeInfo::SetPermission(const std::string& permission)
53 {
54     GTEST_LOG_(INFO) << "MOCK CommonEventSubscribeInfo SetPermission";
55     permission_ = permission;
56 }
57 
GetPermission() const58 std::string CommonEventSubscribeInfo::GetPermission() const
59 {
60     return permission_;
61 }
62 
GetThreadMode() const63 CommonEventSubscribeInfo::ThreadMode CommonEventSubscribeInfo::GetThreadMode() const
64 {
65     return threadMode_;
66 }
67 
SetThreadMode(CommonEventSubscribeInfo::ThreadMode threadMode)68 void CommonEventSubscribeInfo::SetThreadMode(CommonEventSubscribeInfo::ThreadMode threadMode)
69 {
70     threadMode_ = threadMode;
71 }
72 
SetDeviceId(const std::string & deviceId)73 void CommonEventSubscribeInfo::SetDeviceId(const std::string& deviceId)
74 {
75     deviceId_ = deviceId;
76 }
77 
GetDeviceId() const78 std::string CommonEventSubscribeInfo::GetDeviceId() const
79 {
80     return deviceId_;
81 }
82 
GetMatchingSkills() const83 const MatchingSkills& CommonEventSubscribeInfo::GetMatchingSkills() const
84 {
85     return matchingSkills_;
86 }
87 
Marshalling(Parcel & parcel) const88 bool CommonEventSubscribeInfo::Marshalling(Parcel& parcel) const
89 {
90     (void)parcel;
91     return true;
92 }
93 
ReadFromParcel(Parcel & parcel)94 bool CommonEventSubscribeInfo::ReadFromParcel(Parcel& parcel)
95 {
96     (void)parcel;
97     return true;
98 }
99 
Unmarshalling(Parcel & parcel)100 CommonEventSubscribeInfo* CommonEventSubscribeInfo::Unmarshalling(Parcel& parcel)
101 {
102     (void)parcel;
103     CommonEventSubscribeInfo* commonEventSubscribeInfo = new CommonEventSubscribeInfo();
104     return commonEventSubscribeInfo;
105 }
106 } // namespace EventFwk
107 } // namespace OHOS