• 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 #ifndef FOUNDATION_ACE_INTERFACE_INNERKITS_ACE_TEST_MOCK_MOCK_UICONTENT_H
17 #define FOUNDATION_ACE_INTERFACE_INNERKITS_ACE_TEST_MOCK_MOCK_UICONTENT_H
18 
19 #include "gmock/gmock.h"
20 #include "native_engine/native_engine.h"
21 #include "native_engine/native_value.h"
22 #include "ui_content.h"
23 
24 namespace OHOS {
25 namespace Ace {
26 class MockUIContent : public UIContent {
27 public:
28     MockUIContent() = default;
29     ~MockUIContent() override = default;
30     MOCK_METHOD3(Initialize, void(OHOS::Rosen::Window* window, const std::string& url, NativeValue* storage));
31     MOCK_METHOD4(Initialize,
32         void(OHOS::Rosen::Window* window, const std::string& url, NativeValue* storage, uint32_t focusWindowID));
33     MOCK_METHOD0(Foreground, void());
34     MOCK_METHOD0(Background, void());
35     MOCK_METHOD0(Focus, void());
36     MOCK_METHOD0(UnFocus, void());
37     MOCK_METHOD0(Destroy, void());
38     MOCK_METHOD1(OnNewWant, void(const OHOS::AAFwk::Want& want));
39     MOCK_METHOD3(Restore, void(OHOS::Rosen::Window* window, const std::string& contentInfo, NativeValue* storage));
40     MOCK_CONST_METHOD0(GetContentInfo, std::string());
41     MOCK_METHOD0(DestroyUIDirector, void());
42     MOCK_METHOD0(ProcessBackPressed, bool());
43     MOCK_METHOD1(ProcessPointerEvent, bool(const std::shared_ptr<OHOS::MMI::PointerEvent>& pointerEvent));
44     MOCK_METHOD1(ProcessKeyEvent, bool(const std::shared_ptr<OHOS::MMI::KeyEvent>& keyEvent));
45     MOCK_METHOD1(ProcessAxisEvent, bool(const std::shared_ptr<OHOS::MMI::AxisEvent>& axisEvent));
46     MOCK_METHOD1(ProcessVsyncEvent, bool(uint64_t timeStampNanos));
47     MOCK_METHOD1(UpdateConfiguration, void(const std::shared_ptr<OHOS::AppExecFwk::Configuration>& config));
48     MOCK_METHOD3(UpdateViewportConfig, void(const ViewportConfig& config, OHOS::Rosen::WindowSizeChangeReason reason,
49                                            const std::shared_ptr<OHOS::Rosen::RSTransaction>& rsTransaction));
50     MOCK_METHOD2(UpdateWindowMode, void(OHOS::Rosen::WindowMode mode, bool hasDeco));
51     MOCK_METHOD3(HideWindowTitleButton, void(bool hideSplit, bool hideMaximize, bool hideMinimize));
52     MOCK_METHOD1(SetIgnoreViewSafeArea, void(bool ignoreViewSafeArea));
53     MOCK_METHOD0(GetBackgroundColor, uint32_t());
54     MOCK_METHOD1(SetBackgroundColor, void(uint32_t color));
55     MOCK_METHOD2(DumpInfo, void(const std::vector<std::string>& params, std::vector<std::string>& info));
56     MOCK_METHOD1(SetNextFrameLayoutCallback, void(std::function<void()>&& callback));
57     MOCK_METHOD1(NotifyMemoryLevel, void(int32_t level));
58     MOCK_METHOD1(SetAppWindowTitle, void(const std::string& title));
59     MOCK_METHOD1(SetAppWindowIcon, void(const std::shared_ptr<Media::PixelMap>& pixelMap));
60     MOCK_METHOD0(GetFormRootNode, std::shared_ptr<Rosen::RSSurfaceNode>());
61     MOCK_METHOD1(UpdateFormData, void(const std::string& data));
62     MOCK_METHOD1(
63         UpdateFormSharedImage, void(const std::map<std::string, sptr<OHOS::AppExecFwk::FormAshmem>>& imageDataMap));
64     MOCK_METHOD1(SetFormWidth, void(const float width));
65     MOCK_METHOD1(SetFormHeight, void(const float height));
66     MOCK_METHOD0(GetFormWidth, float());
67     MOCK_METHOD0(GetFormHeight, float());
68     MOCK_METHOD2(OnFormSurfaceChange, void(float width, float height));
69     MOCK_METHOD1(SetActionEventHandler, void(std::function<void(const std::string& action)>&& actionCallback));
70     MOCK_METHOD1(SetFormLinkInfoUpdateHandler, void(std::function<void(const std::vector<std::string>&)>&& callback));
71     MOCK_METHOD1(SetErrorEventHandler,
72         void(std::function<void(const std::string& code, const std::string& msg)>&& actionCallback));
73     MOCK_METHOD1(ReloadForm, void(const std::string& url));
74     MOCK_METHOD1(SetIsFocusActive, void(bool isFocusActive));
75 
76     MOCK_METHOD2(CreateModalUIExtension, int32_t(const AAFwk::Want& want, const ModalUIExtensionCallbacks& callbacks));
77     MOCK_METHOD1(CloseModalUIExtension, void(int32_t sessionId));
78 };
79 } // namespace Ace
80 } // namespace OHOS
81 
82 #endif // FOUNDATION_ACE_INTERFACE_INNERKITS_ACE_TEST_MOCK_MOCK_UICONTENT_H
83