• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 "common_event_manager.h"
17 
18 namespace {
19     bool g_mockPublishCommonEvent = true;
20     bool g_mockSubscribeCommonEvent = true;
21 }
22 
MockPublishCommonEvent(bool mockRet)23 void MockPublishCommonEvent(bool mockRet)
24 {
25     g_mockPublishCommonEvent = mockRet;
26 }
27 
MockSubscribeCommonEvent(bool mockRet)28 void MockSubscribeCommonEvent(bool mockRet)
29 {
30     g_mockSubscribeCommonEvent = mockRet;
31 }
32 
33 namespace OHOS {
34 namespace EventFwk {
PublishCommonEvent(const CommonEventData & data)35 bool CommonEventManager::PublishCommonEvent(const CommonEventData& data)
36 {
37     return g_mockPublishCommonEvent;
38 }
39 
SubscribeCommonEvent(const std::shared_ptr<CommonEventSubscriber> & subscriber)40 bool CommonEventManager::SubscribeCommonEvent(const std::shared_ptr<CommonEventSubscriber>& subscriber)
41 {
42     return g_mockSubscribeCommonEvent;
43 }
44 
UnSubscribeCommonEvent(const std::shared_ptr<CommonEventSubscriber> & subscriber)45 bool CommonEventManager::UnSubscribeCommonEvent(const std::shared_ptr<CommonEventSubscriber>& subscriber)
46 {
47     return g_mockSubscribeCommonEvent;
48 }
49 }  // namespace EventFwk
50 }  // namespace OHOS
51