123b3eb3cSopenharmony_ci 223b3eb3cSopenharmony_ci/* 323b3eb3cSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 423b3eb3cSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 523b3eb3cSopenharmony_ci * you may not use this file except in compliance with the License. 623b3eb3cSopenharmony_ci * You may obtain a copy of the License at 723b3eb3cSopenharmony_ci * 823b3eb3cSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 923b3eb3cSopenharmony_ci * 1023b3eb3cSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1123b3eb3cSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1223b3eb3cSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1323b3eb3cSopenharmony_ci * See the License for the specific language governing permissions and 1423b3eb3cSopenharmony_ci * limitations under the License. 1523b3eb3cSopenharmony_ci */ 1623b3eb3cSopenharmony_ci 1723b3eb3cSopenharmony_ci#ifndef FOUNDATION_ACE_INTERFACE_INNERKITS_ACE_TEST_MOCK_MOCK_UICONTENT_H 1823b3eb3cSopenharmony_ci#define FOUNDATION_ACE_INTERFACE_INNERKITS_ACE_TEST_MOCK_MOCK_UICONTENT_H 1923b3eb3cSopenharmony_ci 2023b3eb3cSopenharmony_ci#include "gmock/gmock.h" 2123b3eb3cSopenharmony_ci#include "native_engine/native_engine.h" 2223b3eb3cSopenharmony_ci#include "native_engine/native_value.h" 2323b3eb3cSopenharmony_ci#include "ui_content.h" 2423b3eb3cSopenharmony_ci#include "iremote_object.h" 2523b3eb3cSopenharmony_ci#include "accessibility_element_info.h" 2623b3eb3cSopenharmony_ci#include "serialized_gesture.h" 2723b3eb3cSopenharmony_ci 2823b3eb3cSopenharmony_cinamespace OHOS { 2923b3eb3cSopenharmony_cinamespace Ace { 3023b3eb3cSopenharmony_ciclass MockUIContent : public UIContent { 3123b3eb3cSopenharmony_cipublic: 3223b3eb3cSopenharmony_ci MockUIContent() = default; 3323b3eb3cSopenharmony_ci ~MockUIContent() override = default; 3423b3eb3cSopenharmony_ci 3523b3eb3cSopenharmony_ci MOCK_METHOD3(Initialize, UIContentErrorCode(OHOS::Rosen::Window* window, const std::string& url, 3623b3eb3cSopenharmony_ci napi_value storage)); 3723b3eb3cSopenharmony_ci MOCK_METHOD3(Initialize, UIContentErrorCode(OHOS::Rosen::Window* window, 3823b3eb3cSopenharmony_ci const std::shared_ptr<std::vector<uint8_t>>& content, napi_value storage)); 3923b3eb3cSopenharmony_ci MOCK_METHOD3(InitializeByName, UIContentErrorCode(OHOS::Rosen::Window *window, 4023b3eb3cSopenharmony_ci const std::string &name, napi_value storage)); 4123b3eb3cSopenharmony_ci MOCK_METHOD4(Initialize, 4223b3eb3cSopenharmony_ci void(OHOS::Rosen::Window* window, const std::string& url, napi_value storage, uint32_t focusWindowID)); 4323b3eb3cSopenharmony_ci MOCK_METHOD0(Foreground, void()); 4423b3eb3cSopenharmony_ci MOCK_METHOD0(Background, void()); 4523b3eb3cSopenharmony_ci MOCK_METHOD0(Focus, void()); 4623b3eb3cSopenharmony_ci MOCK_METHOD0(UnFocus, void()); 4723b3eb3cSopenharmony_ci MOCK_METHOD0(Destroy, void()); 4823b3eb3cSopenharmony_ci MOCK_METHOD1(OnNewWant, void(const OHOS::AAFwk::Want& want)); 4923b3eb3cSopenharmony_ci MOCK_METHOD4(Restore, UIContentErrorCode(OHOS::Rosen::Window* window, const std::string& contentInfo, 5023b3eb3cSopenharmony_ci napi_value storage, ContentInfoType type)); 5123b3eb3cSopenharmony_ci MOCK_CONST_METHOD1(GetContentInfo, std::string(ContentInfoType type)); 5223b3eb3cSopenharmony_ci MOCK_METHOD0(DestroyUIDirector, void()); 5323b3eb3cSopenharmony_ci MOCK_METHOD0(ProcessBackPressed, bool()); 5423b3eb3cSopenharmony_ci MOCK_METHOD1(ProcessPointerEvent, bool(const std::shared_ptr<OHOS::MMI::PointerEvent>& pointerEvent)); 5523b3eb3cSopenharmony_ci MOCK_METHOD2(ProcessPointerEventWithCallback, 5623b3eb3cSopenharmony_ci bool(const std::shared_ptr<OHOS::MMI::PointerEvent>& pointerEvent, const std::function<void()>& callback)); 5723b3eb3cSopenharmony_ci MOCK_METHOD2(ProcessKeyEvent, bool(const std::shared_ptr<OHOS::MMI::KeyEvent>& keyEvent, bool isPreIme)); 5823b3eb3cSopenharmony_ci MOCK_METHOD1(ProcessAxisEvent, bool(const std::shared_ptr<OHOS::MMI::AxisEvent>& axisEvent)); 5923b3eb3cSopenharmony_ci MOCK_METHOD1(ProcessVsyncEvent, bool(uint64_t timeStampNanos)); 6023b3eb3cSopenharmony_ci MOCK_METHOD1(UpdateConfiguration, void(const std::shared_ptr<OHOS::AppExecFwk::Configuration>& config)); 6123b3eb3cSopenharmony_ci MOCK_METHOD2(UpdateWindowMode, void(OHOS::Rosen::WindowMode mode, bool hasDeco)); 6223b3eb3cSopenharmony_ci MOCK_METHOD2(UpdateTitleInTargetPos, void(bool isShow, int32_t height)); 6323b3eb3cSopenharmony_ci MOCK_METHOD2(UpdateDecorVisible, void(bool visible, bool hasDeco)); 6423b3eb3cSopenharmony_ci MOCK_METHOD4(HideWindowTitleButton, void(bool hideSplit, bool hideMaximize, bool hideMinimize, bool hideClose)); 6523b3eb3cSopenharmony_ci MOCK_METHOD1(SetIgnoreViewSafeArea, void(bool ignoreViewSafeArea)); 6623b3eb3cSopenharmony_ci MOCK_METHOD0(GetBackgroundColor, uint32_t()); 6723b3eb3cSopenharmony_ci MOCK_METHOD1(SetBackgroundColor, void(uint32_t color)); 6823b3eb3cSopenharmony_ci MOCK_METHOD2(SetWindowContainerColor, void(uint32_t activeColor, uint32_t inactiveColor)); 6923b3eb3cSopenharmony_ci MOCK_METHOD2(DumpInfo, void(const std::vector<std::string>& params, std::vector<std::string>& info)); 7023b3eb3cSopenharmony_ci MOCK_METHOD1(SetNextFrameLayoutCallback, void(std::function<void()>&& callback)); 7123b3eb3cSopenharmony_ci MOCK_METHOD1(NotifyMemoryLevel, void(int32_t level)); 7223b3eb3cSopenharmony_ci MOCK_METHOD1(SetAppWindowTitle, void(const std::string& title)); 7323b3eb3cSopenharmony_ci MOCK_METHOD1(SetAppWindowIcon, void(const std::shared_ptr<Media::PixelMap>& pixelMap)); 7423b3eb3cSopenharmony_ci MOCK_METHOD3(PreInitializeForm, void(OHOS::Rosen::Window* window, const std::string& url, napi_value storage)); 7523b3eb3cSopenharmony_ci MOCK_METHOD0(RunFormPage, void()); 7623b3eb3cSopenharmony_ci MOCK_METHOD0(GetFormRootNode, std::shared_ptr<Rosen::RSSurfaceNode>()); 7723b3eb3cSopenharmony_ci MOCK_METHOD1(UpdateFormData, void(const std::string& data)); 7823b3eb3cSopenharmony_ci MOCK_METHOD1( 7923b3eb3cSopenharmony_ci UpdateFormSharedImage, void(const std::map<std::string, sptr<OHOS::AppExecFwk::FormAshmem>>& imageDataMap)); 8023b3eb3cSopenharmony_ci MOCK_METHOD1(SetFormWidth, void(const float width)); 8123b3eb3cSopenharmony_ci MOCK_METHOD1(SetFormHeight, void(const float height)); 8223b3eb3cSopenharmony_ci MOCK_METHOD0(GetFormWidth, float()); 8323b3eb3cSopenharmony_ci MOCK_METHOD0(GetFormHeight, float()); 8423b3eb3cSopenharmony_ci MOCK_METHOD4(OnFormSurfaceChange, void(float width, float height, OHOS::Rosen::WindowSizeChangeReason reason, 8523b3eb3cSopenharmony_ci const std::shared_ptr<OHOS::Rosen::RSTransaction> &rsTransaction)); 8623b3eb3cSopenharmony_ci MOCK_METHOD1(SetActionEventHandler, void(std::function<void(const std::string& action)>&& actionCallback)); 8723b3eb3cSopenharmony_ci MOCK_METHOD1(SetFormLinkInfoUpdateHandler, void(std::function<void(const std::vector<std::string>&)>&& callback)); 8823b3eb3cSopenharmony_ci MOCK_METHOD1(SetErrorEventHandler, 8923b3eb3cSopenharmony_ci void(std::function<void(const std::string& code, const std::string& msg)>&& actionCallback)); 9023b3eb3cSopenharmony_ci MOCK_METHOD1(ReloadForm, void(const std::string& url)); 9123b3eb3cSopenharmony_ci MOCK_METHOD1(SetIsFocusActive, void(bool isFocusActive)); 9223b3eb3cSopenharmony_ci 9323b3eb3cSopenharmony_ci MOCK_METHOD3(CreateModalUIExtension, int32_t(const AAFwk::Want& want, 9423b3eb3cSopenharmony_ci const ModalUIExtensionCallbacks& callbacks, const ModalUIExtensionConfig& config)); 9523b3eb3cSopenharmony_ci MOCK_METHOD1(CloseModalUIExtension, void(int32_t sessionId)); 9623b3eb3cSopenharmony_ci MOCK_METHOD1(SetParentToken, void(sptr<IRemoteObject> token)); 9723b3eb3cSopenharmony_ci MOCK_METHOD0(GetParentToken, sptr<IRemoteObject>()); 9823b3eb3cSopenharmony_ci 9923b3eb3cSopenharmony_ci MOCK_METHOD2(SetContainerModalTitleVisible, void(bool customTitleSettedShow, bool floatingTitleSettedShow)); 10023b3eb3cSopenharmony_ci MOCK_METHOD1(SetContainerModalTitleHeight, void(int height)); 10123b3eb3cSopenharmony_ci MOCK_METHOD0(GetContainerModalTitleHeight, int()); 10223b3eb3cSopenharmony_ci MOCK_METHOD2(GetContainerModalButtonsRect, bool(Rosen::Rect& containerModal, Rosen::Rect& buttons)); 10323b3eb3cSopenharmony_ci MOCK_METHOD1(SubscribeContainerModalButtonsRectChange, void( 10423b3eb3cSopenharmony_ci std::function<void(Rosen::Rect& containerModal, Rosen::Rect& buttons)>&& callback)); 10523b3eb3cSopenharmony_ci MOCK_METHOD0(GetFormSerializedGesture, SerializedGesture()); 10623b3eb3cSopenharmony_ci MOCK_METHOD1(SetUIExtensionSubWindow, void(bool isUIExtensionSubWindow)); 10723b3eb3cSopenharmony_ci MOCK_METHOD1(SetUIExtensionAbilityProcess, void(bool isUIExtensionAbilityProcess)); 10823b3eb3cSopenharmony_ci MOCK_METHOD1(SetUIExtensionAbilityHost, void(bool isUIExtensionAbilityHost)); 10923b3eb3cSopenharmony_ci MOCK_METHOD0(IsUIExtensionSubWindow, bool()); 11023b3eb3cSopenharmony_ci MOCK_METHOD0(IsUIExtensionAbilityProcess, bool()); 11123b3eb3cSopenharmony_ci MOCK_METHOD0(IsUIExtensionAbilityHost, bool()); 11223b3eb3cSopenharmony_ci MOCK_METHOD2(SetForceSplitEnable, void(bool isForceSplit, const std::string& homePage)); 11323b3eb3cSopenharmony_ci 11423b3eb3cSopenharmony_ci#ifndef PREVIEW 11523b3eb3cSopenharmony_ci MOCK_METHOD4( 11623b3eb3cSopenharmony_ci SearchElementInfoByAccessibilityId, void(int64_t elementId, 11723b3eb3cSopenharmony_ci int32_t mode, int64_t baseParent, std::list<Accessibility::AccessibilityElementInfo>& output)); 11823b3eb3cSopenharmony_ci MOCK_METHOD4( 11923b3eb3cSopenharmony_ci SearchElementInfosByText, void(int64_t elementId, 12023b3eb3cSopenharmony_ci const std::string& text, int64_t baseParent, std::list<Accessibility::AccessibilityElementInfo>& output)); 12123b3eb3cSopenharmony_ci MOCK_METHOD4( 12223b3eb3cSopenharmony_ci FindFocusedElementInfo, void(int64_t elementId, 12323b3eb3cSopenharmony_ci int32_t focusType, int64_t baseParent, Accessibility::AccessibilityElementInfo& output)); 12423b3eb3cSopenharmony_ci MOCK_METHOD4( 12523b3eb3cSopenharmony_ci FocusMoveSearch, void(int64_t elementId, int32_t direction, 12623b3eb3cSopenharmony_ci int64_t baseParent, Accessibility::AccessibilityElementInfo& output)); 12723b3eb3cSopenharmony_ci#endif 12823b3eb3cSopenharmony_ci MOCK_METHOD1(GetAppPaintSize, void(OHOS::Rosen::Rect&)); 12923b3eb3cSopenharmony_ci MOCK_METHOD1(GetWindowPaintSize, void(OHOS::Rosen::Rect&)); 13023b3eb3cSopenharmony_ci MOCK_METHOD3(CreateCustomPopupUIExtension, int32_t(const AAFwk::Want& want, 13123b3eb3cSopenharmony_ci const ModalUIExtensionCallbacks& callbacks, const CustomPopupUIExtensionConfig& config)); 13223b3eb3cSopenharmony_ci MOCK_METHOD1(DestroyCustomPopupUIExtension, void(int32_t nodeId)); 13323b3eb3cSopenharmony_ci MOCK_METHOD1(UpdateTransform, void(const OHOS::Rosen::Transform& transform)); 13423b3eb3cSopenharmony_ci MOCK_METHOD1(SetContentNodeGrayScale, void(float grayscale)); 13523b3eb3cSopenharmony_ci}; 13623b3eb3cSopenharmony_ci} // namespace Ace 13723b3eb3cSopenharmony_ci} // namespace OHOS 13823b3eb3cSopenharmony_ci 13923b3eb3cSopenharmony_ci#endif // FOUNDATION_ACE_INTERFACE_INNERKITS_ACE_TEST_MOCK_MOCK_UICONTENT_H 140