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
CommonEventData(const Want & want,const int & code,const std::string & data)27 CommonEventData::CommonEventData(const Want& want, const int& code, const std::string& data)
28 : want_(want), code_(code), data_(data)
29 {}
30
~CommonEventData()31 CommonEventData::~CommonEventData()
32 {}
33
SetCode(const int & code)34 void CommonEventData::SetCode(const int& code)
35 {
36 code_ = code;
37 }
38
GetCode() const39 int CommonEventData::GetCode() const
40 {
41 return code_;
42 }
43
SetData(const std::string & data)44 void CommonEventData::SetData(const std::string& data)
45 {
46 data_ = data;
47 }
48
GetData() const49 std::string CommonEventData::GetData() const
50 {
51 return data_;
52 }
53
SetWant(const Want & want)54 void CommonEventData::SetWant(const Want& want)
55 {
56 GTEST_LOG_(INFO) << "MOCK CommonEventData SetWant";
57 want_ = want;
58 }
59
GetWant() const60 const Want& CommonEventData::GetWant() const
61 {
62 GTEST_LOG_(INFO) << "MOCK CommonEventData GetWant";
63 return want_;
64 }
65
Marshalling(Parcel & parcel) const66 bool CommonEventData::Marshalling(Parcel& parcel) const
67 {
68 return true;
69 }
70
ReadFromParcel(Parcel & parcel)71 bool CommonEventData::ReadFromParcel(Parcel& parcel)
72 {
73 return true;
74 }
75
Unmarshalling(Parcel & parcel)76 CommonEventData* CommonEventData::Unmarshalling(Parcel& parcel)
77 {
78 CommonEventData* commonEventData = new CommonEventData();
79
80 return commonEventData;
81 }
82 } // namespace EventFwk
83 } // namespace OHOS