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