• 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 MOCK_INPUT_WINDOWS_MANAGER_H
17 #define MOCK_INPUT_WINDOWS_MANAGER_H
18 
19 #include <gmock/gmock.h>
20 
21 #include "event_dispatch_handler.h"
22 #include "event_filter_handler.h"
23 #include "event_normalize_handler.h"
24 #include "i_pointer_drawing_manager.h"
25 #include "input_windows_manager.h"
26 #include "uds_server.h"
27 #include "window_info.h"
28 
29 namespace OHOS {
30 namespace MMI {
31 class InputWindowsManagerInterface {
32 public:
InputWindowsManagerInterface()33     InputWindowsManagerInterface(){};
~InputWindowsManagerInterface()34     virtual ~InputWindowsManagerInterface(){};
35     virtual std::shared_ptr<EventNormalizeHandler> GetEventNormalizeHandler() = 0;
36     virtual std::shared_ptr<EventDispatchHandler> GetEventDispatchHandler() = 0;
37     virtual UDSServer *GetUDSServer() = 0;
38     virtual bool IsAncoWindow(const WindowInfo &window) = 0;
39     virtual std::optional<WindowInfo> GetWindowInfoById(int32_t windowId) = 0;
40     virtual bool IsInHotArea(int32_t x, int32_t y, const std::vector<Rect> &rects, const WindowInfo &window) = 0;
41     virtual bool IsSceneBoardEnabled() = 0;
42     virtual std::optional<WindowInfo> GetWindowAndDisplayInfo(int32_t windowId, int32_t displayId) = 0;
43     virtual std::string ReadJsonFile(const std::string &filePath) = 0;
44 };
45 
46 class MockInputWindowsManager : public InputWindowsManagerInterface {
47 public:
48     MockInputWindowsManager();
49     ~MockInputWindowsManager() override;
50 
51     MOCK_METHOD(std::shared_ptr<EventNormalizeHandler>, GetEventNormalizeHandler, ());
52     MOCK_METHOD(std::shared_ptr<EventDispatchHandler>, GetEventDispatchHandler, ());
53     MOCK_METHOD(UDSServer *, GetUDSServer, ());
54     MOCK_METHOD(bool, IsAncoWindow, (const WindowInfo &));
55     MOCK_METHOD(std::optional<WindowInfo>, GetWindowInfoById, (int32_t));
56     MOCK_METHOD(bool, IsInHotArea, (int32_t, int32_t, const std::vector<Rect> &, const WindowInfo &));
57     MOCK_METHOD(bool, IsSceneBoardEnabled, ());
58     MOCK_METHOD(std::optional<WindowInfo>, GetWindowAndDisplayInfo, (int32_t, int32_t));
59     MOCK_METHOD(std::string, ReadJsonFile, (const std::string &));
60 };
61 } // namespace MMI
62 } // namespace OHOS
63 #endif
64