• 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 #ifndef MMI_INPUT_EVENT_HANDLER_MOCK_H
17 #define MMI_INPUT_EVENT_HANDLER_MOCK_H
18 #include "event_filter_handler.h"
19 #include "event_interceptor_handler.h"
20 #include "event_monitor_handler.h"
21 #include "event_normalize_handler.h"
22 #include "key_subscriber_handler.h"
23 #include "switch_subscriber_handler.h"
24 
25 namespace OHOS {
26 namespace MMI {
27 class IInputEventHandlerManager {
28 public:
29     IInputEventHandlerManager() = default;
30     virtual ~IInputEventHandlerManager() = default;
31 
32     virtual std::shared_ptr<EventNormalizeHandler> GetEventNormalizeHandler() const = 0;
33     virtual std::shared_ptr<EventInterceptorHandler> GetInterceptorHandler() const = 0;
34     virtual std::shared_ptr<KeySubscriberHandler> GetSubscriberHandler() const = 0;
35     virtual std::shared_ptr<SwitchSubscriberHandler> GetSwitchSubscriberHandler() const = 0;
36     virtual std::shared_ptr<EventMonitorHandler> GetMonitorHandler() const = 0;
37     virtual std::shared_ptr<EventFilterHandler> GetFilterHandler() const = 0;
38 };
39 
40 class InputEventHandlerManager final : public IInputEventHandlerManager {
41 public:
42     InputEventHandlerManager() = default;
43     ~InputEventHandlerManager() override = default;
44 
45     MOCK_METHOD(std::shared_ptr<EventNormalizeHandler>, GetEventNormalizeHandler, (), (const));
46     MOCK_METHOD(std::shared_ptr<EventInterceptorHandler>, GetInterceptorHandler, (), (const));
47     MOCK_METHOD(std::shared_ptr<KeySubscriberHandler>, GetSubscriberHandler, (), (const));
48     MOCK_METHOD(std::shared_ptr<SwitchSubscriberHandler>, GetSwitchSubscriberHandler, (), (const));
49     MOCK_METHOD(std::shared_ptr<EventMonitorHandler>, GetMonitorHandler, (), (const));
50     MOCK_METHOD(std::shared_ptr<EventFilterHandler>, GetFilterHandler, (), (const));
51 
52     static std::shared_ptr<InputEventHandlerManager> GetInstance();
53     static void ReleaseInstance();
54 
55 private:
56     static std::shared_ptr<InputEventHandlerManager> instance_;
57 };
58 
59 #define InputHandler InputEventHandlerManager::GetInstance()
60 } // namespace MMI
61 } // namespace OHOS
62 #endif // MMI_INPUT_EVENT_HANDLER_MOCK_H