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 #include "interfaces/include/ws_common.h" 17 #include "session/container/include/zidl/session_stage_interface.h" 18 #include "session/host/include/session.h" 19 #include <gmock/gmock.h> 20 21 namespace OHOS { 22 namespace Rosen { 23 class SessionMocker : public Session { 24 public: SessionMocker(const SessionInfo & info)25 SessionMocker(const SessionInfo& info) : Session(info) {} ~SessionMocker()26 ~SessionMocker() {} 27 MOCK_METHOD6(Connect, WSError(const sptr<ISessionStage>& sessionStage, 28 const sptr<IWindowEventChannel>& eventChannel, const std::shared_ptr<RSSurfaceNode>& surfaceNode, 29 SystemSessionConfig& systemConfig, sptr<WindowSessionProperty> property, sptr<IRemoteObject> token)); 30 MOCK_METHOD7(CreateAndConnectSpecificSession, WSError(const sptr<ISessionStage>& sessionStage, 31 const sptr<IWindowEventChannel>& eventChannel, const std::shared_ptr<RSSurfaceNode>& surfaceNode, 32 sptr<WindowSessionProperty> property, int32_t& persistentId, sptr<ISession>& session, 33 sptr<IRemoteObject> token)); 34 35 MOCK_METHOD1(Foreground, WSError(sptr<WindowSessionProperty> property)); 36 MOCK_METHOD0(Background, WSError(void)); 37 MOCK_METHOD0(Disconnect, WSError(void)); 38 39 MOCK_METHOD2(UpdateSessionRect, WSError(const WSRect& rect, const SizeChangeReason& reason)); 40 41 MOCK_METHOD0(Recover, WSError(void)); 42 MOCK_METHOD0(Maximize, WSError(void)); 43 MOCK_METHOD1(PendingSessionActivation, WSError(const sptr<AAFwk::SessionInfo> info)); 44 MOCK_METHOD1(UpdateActiveStatus, WSError(bool isActive)); 45 MOCK_METHOD1(OnSessionEvent, WSError(SessionEvent event)); 46 MOCK_METHOD0(RequestSessionBack, WSError(void)); 47 MOCK_METHOD0(RaiseToAppTop, WSError(void)); 48 MOCK_METHOD1(GetAvoidAreaByType, AvoidArea(AvoidAreaType type)); 49 MOCK_METHOD1(SetAspectRatio, WSError(float ratio)); 50 MOCK_METHOD1(ResetAspectRatio, WSError(float ratio)); 51 MOCK_METHOD1(OnNeedAvoid, WSError(bool status)); 52 MOCK_METHOD1(SetGlobalMaximizeMode, WSError(MaximizeMode mode)); 53 }; 54 } // namespace Rosen 55 } // namespace OHOS 56