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 FOUNDATION_ACE_FRAMEWORKS_CORE_PIPELINE_NG_TEST_MOCK_MOCK_WINDOW_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_PIPELINE_NG_TEST_MOCK_MOCK_WINDOW_H 18 19 #include "gmock/gmock.h" 20 21 #include "core/common/window.h" 22 23 namespace OHOS::Ace { 24 class ACE_EXPORT MockWindow : public Window { 25 public: 26 MockWindow() = default; 27 ~MockWindow() override = default; 28 29 MOCK_METHOD0(RequestFrame, void()); 30 MOCK_METHOD0(Destroy, void()); 31 MOCK_METHOD0(Init, void()); 32 MOCK_METHOD0(OnShow, void()); 33 MOCK_METHOD0(OnHide, void()); 34 MOCK_METHOD1(FlushTasks, void(std::function<void()> callback)); 35 MOCK_METHOD0(FlushModifier, void()); 36 MOCK_CONST_METHOD0(GetRefreshRate, float()); 37 MOCK_CONST_METHOD0(GetCurrentWindowRect, Rect()); 38 MOCK_CONST_METHOD0(GetRSUIDirector, std::shared_ptr<Rosen::RSUIDirector>()); 39 MOCK_CONST_METHOD0(GetStatusBarHeight, uint32_t()); 40 MOCK_METHOD1(SetDrawTextAsBitmap, void(bool useBitmap)); 41 MOCK_METHOD1(SetRootFrameNode, void(const RefPtr<NG::FrameNode>& root)); 42 MOCK_METHOD1(SetInstanceId, void(int32_t instanceId)); 43 MOCK_METHOD1(SetTaskExecutor, void(const RefPtr<TaskExecutor>& taskExecutor)); 44 MOCK_METHOD1(SetVsyncCallback, void(AceVsyncCallback&& callback)); 45 MOCK_METHOD1(SetRootRenderNode, void(const RefPtr<RenderNode>& root)); 46 MOCK_METHOD1(FlushAnimation, bool(uint64_t timeStamp)); 47 MOCK_METHOD2(RecordFrameTime, void(uint64_t timeStamp, const std::string& name)); 48 }; 49 } // namespace OHOS::Ace 50 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_PIPELINE_NG_TEST_MOCK_MOCK_WINDOW_H 51