1 /* 2 * Copyright (c) 2021 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_AAFWK_ABILITY_MANAGER_PROXY_MOCK_H 17 #define OHOS_AAFWK_ABILITY_MANAGER_PROXY_MOCK_H 18 19 #include "gmock/gmock.h" 20 #include "ability_manager_interface.h" 21 #include "hilog_wrapper.h" 22 #include "iremote_proxy.h" 23 24 namespace OHOS { 25 namespace AAFwk { 26 class MockAbilityManagerProxy : public IRemoteProxy<IAbilityManager> { 27 public: MockAbilityManagerProxy(const sptr<IRemoteObject> & impl)28 explicit MockAbilityManagerProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<IAbilityManager>(impl) 29 {} ~MockAbilityManagerProxy()30 virtual ~MockAbilityManagerProxy() 31 {} 32 33 MOCK_METHOD2(StartAbility, int(const Want &want, int requestCode)); 34 MOCK_METHOD3(StartAbility, int(const Want &want, const sptr<IRemoteObject> &callerToken, int requestCode)); 35 MOCK_METHOD2(TerminateAbilityByCaller, int(const sptr<IRemoteObject> &callerToken, int requestCode)); 36 MOCK_METHOD3(TerminateAbility, int(const sptr<IRemoteObject> &token, int resultCode, const Want *resultWant)); 37 MOCK_METHOD3(ConnectAbility, 38 int(const Want &want, const sptr<IAbilityConnection> &connect, const sptr<IRemoteObject> &callerToken)); 39 MOCK_METHOD1(DisconnectAbility, int(const sptr<IAbilityConnection> &connect)); 40 MOCK_METHOD3(AcquireDataAbility, sptr<IAbilityScheduler>(const Uri &, bool, const sptr<IRemoteObject> &)); 41 MOCK_METHOD2(ReleaseDataAbility, int(sptr<IAbilityScheduler>, const sptr<IRemoteObject> &)); 42 MOCK_METHOD2(AddWindowInfo, void(const sptr<IRemoteObject> &token, int32_t windowToken)); 43 MOCK_METHOD2(AttachAbilityThread, int(const sptr<IAbilityScheduler> &scheduler, const sptr<IRemoteObject> &token)); 44 MOCK_METHOD2(AbilityTransitionDone, int(const sptr<IRemoteObject> &token, int state)); 45 MOCK_METHOD2( 46 ScheduleConnectAbilityDone, int(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &remoteObject)); 47 MOCK_METHOD1(ScheduleDisconnectAbilityDone, int(const sptr<IRemoteObject> &token)); 48 MOCK_METHOD1(ScheduleCommandAbilityDone, int(const sptr<IRemoteObject> &)); 49 MOCK_METHOD2(DumpState, void(const std::string &args, std::vector<std::string> &state)); 50 MOCK_METHOD2(TerminateAbilityResult, int(const sptr<IRemoteObject> &, int startId)); 51 MOCK_METHOD1(StopServiceAbility, int(const Want &)); 52 MOCK_METHOD1(GetAllStackInfo, int(StackInfo &stackInfo)); 53 MOCK_METHOD3(GetRecentMissions, int(const int32_t, const int32_t, std::vector<AbilityMissionInfo> &)); 54 MOCK_METHOD2(GetMissionSnapshot, int(const int32_t, MissionSnapshotInfo &)); 55 MOCK_METHOD1(RemoveMission, int(int)); 56 MOCK_METHOD1(RemoveStack, int(int)); 57 MOCK_METHOD1(MoveMissionToTop, int(int32_t)); 58 MOCK_METHOD1(KillProcess, int(const std::string &)); 59 MOCK_METHOD1(UninstallApp, int(const std::string &)); 60 MOCK_METHOD4(OnRemoteRequest, int(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)); 61 MOCK_METHOD2( 62 GetWantSender, sptr<IWantSender>(const WantSenderInfo &wantSenderInfo, const sptr<IRemoteObject> &callerToken)); 63 MOCK_METHOD2(SendWantSender, int(const sptr<IWantSender> &target, const SenderInfo &senderInfo)); 64 MOCK_METHOD1(CancelWantSender, void(const sptr<IWantSender> &sender)); 65 MOCK_METHOD1(GetPendingWantUid, int(const sptr<IWantSender> &target)); 66 MOCK_METHOD1(GetPendingWantBundleName, std::string(const sptr<IWantSender> &target)); 67 MOCK_METHOD1(GetPendingWantCode, int(const sptr<IWantSender> &target)); 68 MOCK_METHOD1(GetPendingWantType, int(const sptr<IWantSender> &target)); 69 MOCK_METHOD2(RegisterCancelListener, void(const sptr<IWantSender> &sender, const sptr<IWantReceiver> &receiver)); 70 MOCK_METHOD2(UnregisterCancelListener, void(const sptr<IWantSender> &sender, const sptr<IWantReceiver> &receiver)); 71 MOCK_METHOD2(GetPendingRequestWant, int(const sptr<IWantSender> &target, std::shared_ptr<Want> &want)); 72 73 MOCK_METHOD2(MoveMissionToEnd, int(const sptr<IRemoteObject> &token, const bool nonFirst)); 74 MOCK_METHOD1(IsFirstInMission, bool(const sptr<IRemoteObject> &token)); 75 MOCK_METHOD4(CompelVerifyPermission, int(const std::string &permission, int pid, int uid, std::string &message)); 76 MOCK_METHOD0(PowerOff, int()); 77 MOCK_METHOD0(PowerOn, int()); 78 MOCK_METHOD1(GetPendingWantUserId, int(const sptr<IWantSender> &target)); 79 public: 80 int id_; 81 }; 82 } // namespace AAFwk 83 } // namespace OHOS 84 #endif // OHOS_AAFWK_ABILITY_MANAGER_PROXY_MOCK_H 85