• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 "mock_common_event_manager.h"
17 
18 namespace OHOS {
19 namespace EventFwk {
PublishCommonEvent(const CommonEventData & data)20 bool CommonEventManager::PublishCommonEvent(const CommonEventData &data)
21 {
22     return PowerMgr::MockBatteryCommonEventManager::PublishCommonEvent(data);
23 }
24 
PublishCommonEventAsUser(const CommonEventData & data,const int32_t & userId)25 bool CommonEventManager::PublishCommonEventAsUser(const CommonEventData &data, const int32_t &userId)
26 {
27     return PowerMgr::MockBatteryCommonEventManager::PublishCommonEventAsUser(data, userId);
28 }
29 
30 
PublishCommonEvent(const CommonEventData & data,const CommonEventPublishInfo & publishInfo)31 bool CommonEventManager::PublishCommonEvent(
32     const CommonEventData &data, const CommonEventPublishInfo &publishInfo)
33 {
34     return PowerMgr::MockBatteryCommonEventManager::PublishCommonEvent(data, publishInfo);
35 }
36 
37 
NewPublishCommonEvent(const CommonEventData & data,const CommonEventPublishInfo & publishInfo)38 int32_t CommonEventManager::NewPublishCommonEvent(
39     const CommonEventData &data, const CommonEventPublishInfo &publishInfo)
40 {
41     return PowerMgr::MockBatteryCommonEventManager::NewPublishCommonEvent(data, publishInfo);
42 }
43 
PublishCommonEventAsUser(const CommonEventData & data,const CommonEventPublishInfo & publishInfo,const int32_t & userId)44 bool CommonEventManager::PublishCommonEventAsUser(
45     const CommonEventData &data,
46     const CommonEventPublishInfo &publishInfo,
47     const int32_t &userId)
48 {
49     return PowerMgr::MockBatteryCommonEventManager::PublishCommonEventAsUser(data, publishInfo, userId);
50 }
51 
52 
NewPublishCommonEventAsUser(const CommonEventData & data,const CommonEventPublishInfo & publishInfo,const int32_t & userId)53 int32_t CommonEventManager::NewPublishCommonEventAsUser(
54     const CommonEventData &data,
55     const CommonEventPublishInfo &publishInfo,
56     const int32_t &userId)
57 {
58     return PowerMgr::MockBatteryCommonEventManager::PublishCommonEventAsUser(data, publishInfo, userId);
59 }
60 }
61 
62 namespace PowerMgr {
63 bool MockBatteryCommonEventManager::boolReturnValue_ = false;
64 int32_t MockBatteryCommonEventManager::int32ReturnValue_ = 0;
65 
PublishCommonEvent(const EventFwk::CommonEventData & data)66 bool MockBatteryCommonEventManager::PublishCommonEvent(const EventFwk::CommonEventData &data)
67 {
68     return boolReturnValue_;
69 }
70 
PublishCommonEventAsUser(const EventFwk::CommonEventData & data,const int32_t & userId)71 bool MockBatteryCommonEventManager::PublishCommonEventAsUser(
72     const EventFwk::CommonEventData &data, const int32_t &userId)
73 {
74     return boolReturnValue_;
75 }
76 
PublishCommonEvent(const EventFwk::CommonEventData & data,const EventFwk::CommonEventPublishInfo & publishInfo)77 bool MockBatteryCommonEventManager::PublishCommonEvent(
78     const EventFwk::CommonEventData &data, const EventFwk::CommonEventPublishInfo &publishInfo)
79 {
80     return boolReturnValue_;
81 }
82 
NewPublishCommonEvent(const EventFwk::CommonEventData & data,const EventFwk::CommonEventPublishInfo & publishInfo)83 int32_t MockBatteryCommonEventManager::NewPublishCommonEvent(
84     const EventFwk::CommonEventData &data, const EventFwk::CommonEventPublishInfo &publishInfo)
85 {
86     return int32ReturnValue_;
87 }
88 
PublishCommonEventAsUser(const EventFwk::CommonEventData & data,const EventFwk::CommonEventPublishInfo & publishInfo,const int32_t & userId)89 bool MockBatteryCommonEventManager::PublishCommonEventAsUser(
90     const EventFwk::CommonEventData &data,
91     const EventFwk::CommonEventPublishInfo &publishInfo,
92     const int32_t &userId)
93 {
94     return boolReturnValue_;
95 }
96 
NewPublishCommonEventAsUser(const EventFwk::CommonEventData & data,const EventFwk::CommonEventPublishInfo & publishInfo,const int32_t & userId)97 int32_t MockBatteryCommonEventManager::NewPublishCommonEventAsUser(
98     const EventFwk::CommonEventData &data,
99     const EventFwk::CommonEventPublishInfo &publishInfo,
100     const int32_t &userId)
101 {
102     return int32ReturnValue_;
103 }
104 }
105 }