• 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 namespace OHOS {
24 namespace AppExecFwk {
25     class Ability;
26     class Configuration;
27 } // namespace AppExecFwk
28 namespace AAFwk {
29     class Want;
30 } // namespace AAFwk
31 namespace MMI {
32     class PointerEvent;
33     class AxisEvent;
34 } // namespace MMI
35 namespace Media {
36     class PixelMap;
37 } // namespace Media
38 } // namespace OHOS
39 namespace OHOS {
40 namespace Ace {
41 class UIContentMocker : public UIContent {
42 public:
43     MOCK_METHOD3(Initialize, void(OHOS::Rosen::Window* window, const std::string& url, NativeValue* storage));
44     MOCK_METHOD0(Foreground, void());
45     MOCK_METHOD0(Background, void());
46     MOCK_METHOD0(Focus, void());
47     MOCK_METHOD0(UnFocus, void());
48     MOCK_METHOD0(Destroy, void());
49     MOCK_METHOD1(OnNewWant, void(const OHOS::AAFwk::Want& want));
50     MOCK_METHOD3(Restore, void(OHOS::Rosen::Window* window, const std::string& contentInfo, NativeValue* storage));
51     MOCK_CONST_METHOD0(GetContentInfo, std::string());
52     MOCK_METHOD0(DestroyUIDirector, void());
53     MOCK_METHOD0(ProcessBackPressed, bool());
54     MOCK_METHOD1(ProcessPointerEvent, bool(const std::shared_ptr<OHOS::MMI::PointerEvent>& pointerEvent));
55     MOCK_METHOD1(ProcessKeyEvent, bool(const std::shared_ptr<OHOS::MMI::KeyEvent>& keyEvent));
56     MOCK_METHOD1(ProcessAxisEvent, bool(const std::shared_ptr<OHOS::MMI::AxisEvent>& axisEvent));
57     MOCK_METHOD1(ProcessVsyncEvent, bool(uint64_t timeStampNanos));
58     MOCK_METHOD1(UpdateConfiguration, void(const std::shared_ptr<OHOS::AppExecFwk::Configuration>& config));
59     MOCK_METHOD2(UpdateViewportConfig, void(const ViewportConfig& config, OHOS::Rosen::WindowSizeChangeReason reason));
60     MOCK_METHOD1(UpdateWindowMode, void(OHOS::Rosen::WindowMode mode));
61     MOCK_METHOD3(HideWindowTitleButton, void(bool hideSplit, bool hideMaximize, bool hideMinimize));
62     MOCK_METHOD0(GetBackgroundColor, uint32_t());
63     MOCK_METHOD1(SetBackgroundColor, void(uint32_t color));
64     MOCK_METHOD2(DumpInfo, void(const std::vector<std::string>& params, std::vector<std::string>& info));
65     MOCK_METHOD1(SetNextFrameLayoutCallback, void(std::function<void()>&& callback));
66     MOCK_METHOD1(NotifyMemoryLevel, void(int32_t level));
67     MOCK_METHOD1(SetAppWindowTitle, void(const std::string& title));
68     MOCK_METHOD1(SetAppWindowIcon, void(const std::shared_ptr<Media::PixelMap>& pixelMap));
69     MOCK_METHOD0(GetFormRootNode, std::shared_ptr<Rosen::RSSurfaceNode>());
70     MOCK_METHOD1(UpdateFormData, void(const std::string& data));
71     MOCK_METHOD1(SetFormWidth, void(const float width));
72     MOCK_METHOD1(SetFormHeight, void(const float height));
73     MOCK_METHOD0(GetFormWidth, float());
74     MOCK_METHOD0(GetFormHeight, float());
75     MOCK_METHOD1(SetActionEventHandler, void(std::function<void(const std::string& action)>&& actionCallback));
76     MOCK_METHOD1(SetErrorEventHandler,
77         void(std::function<void(const std::string& code, const std::string& msg)>&& actionCallback));
78 };
79 } // namespace Ace
80 } // namespace OHOS
81 
82 #endif
83