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_data.h"
18
19 namespace OHOS {
20 namespace EventFwk {
CommonEventData()21 CommonEventData::CommonEventData() : code_(0)
22 {}
23
CommonEventData(const Want & want)24 CommonEventData::CommonEventData(const Want& want) : want_(want), code_(0)
25 {
26 (void)want;
27 }
28
CommonEventData(const Want & want,const int & code,const std::string & data)29 CommonEventData::CommonEventData(const Want& want, const int& code, const std::string& data)
30 : want_(want), code_(code), data_(data)
31 {
32 (void)want;
33 (void)code;
34 (void)data;
35 }
36
~CommonEventData()37 CommonEventData::~CommonEventData()
38 {}
39
SetCode(const int & code)40 void CommonEventData::SetCode(const int& code)
41 {
42 code_ = code;
43 }
44
GetCode() const45 int CommonEventData::GetCode() const
46 {
47 return code_;
48 }
49
SetData(const std::string & data)50 void CommonEventData::SetData(const std::string& data)
51 {
52 data_ = data;
53 }
54
GetData() const55 std::string CommonEventData::GetData() const
56 {
57 return data_;
58 }
59
SetWant(const Want & want)60 void CommonEventData::SetWant(const Want& want)
61 {
62 GTEST_LOG_(INFO) << "MOCK CommonEventData SetWant";
63 want_ = want;
64 }
65
GetWant() const66 const Want& CommonEventData::GetWant() const
67 {
68 GTEST_LOG_(INFO) << "MOCK CommonEventData GetWant";
69 return want_;
70 }
71
Marshalling(Parcel & parcel) const72 bool CommonEventData::Marshalling(Parcel& parcel) const
73 {
74 (void)parcel;
75 return true;
76 }
77
ReadFromParcel(Parcel & parcel)78 bool CommonEventData::ReadFromParcel(Parcel& parcel)
79 {
80 (void)parcel;
81 return true;
82 }
83
Unmarshalling(Parcel & parcel)84 CommonEventData* CommonEventData::Unmarshalling(Parcel& parcel)
85 {
86 (void)parcel;
87 CommonEventData* commonEventData = new CommonEventData();
88 return commonEventData;
89 }
90 } // namespace EventFwk
91 } // namespace OHOS