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