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 #ifndef OHOS_APPEXECFWK_MOCK_SYSTEM_ABILITY_MANAGER_H 17 #define OHOS_APPEXECFWK_MOCK_SYSTEM_ABILITY_MANAGER_H 18 19 #include "gmock/gmock.h" 20 #include "if_system_ability_manager.h" 21 #include "iremote_object.h" 22 #include "iremote_stub.h" 23 24 namespace OHOS { 25 namespace AppExecFwk { 26 class MockSystemAbilityManager : public IRemoteStub<ISystemAbilityManager> { 27 public: 28 MockSystemAbilityManager() = default; 29 ~MockSystemAbilityManager() = default; 30 virtual sptr<IRemoteObject> GetSystemAbility(int32_t systemAbilityId); 31 32 MOCK_METHOD1(ListSystemAbilities, std::vector<std::u16string>(unsigned int)); 33 MOCK_METHOD2(GetSystemAbility, sptr<IRemoteObject>(int32_t, const std::string &)); 34 MOCK_METHOD1(CheckSystemAbility, sptr<IRemoteObject>(int32_t)); 35 MOCK_METHOD2(CheckSystemAbility, sptr<IRemoteObject>(int32_t, const std::string &)); 36 MOCK_METHOD2(CheckSystemAbility, sptr<IRemoteObject>(int32_t, bool &)); 37 MOCK_METHOD1(RemoveSystemAbility, int32_t(int32_t)); 38 MOCK_METHOD2(SubscribeSystemAbility, int32_t(int32_t, const sptr<ISystemAbilityStatusChange> &)); 39 MOCK_METHOD2(UnSubscribeSystemAbility, int32_t(int32_t, const sptr<ISystemAbilityStatusChange> &)); 40 MOCK_METHOD2(AddOnDemandSystemAbilityInfo, int32_t(int32_t, const std::u16string &)); 41 MOCK_METHOD3(AddSystemAbility, int32_t(int32_t, const sptr<IRemoteObject> &, const SAExtraProp &)); 42 MOCK_METHOD2(AddSystemProcess, int32_t(const std::u16string &, const sptr<IRemoteObject> &)); 43 MOCK_METHOD2(LoadSystemAbility, sptr<IRemoteObject>(int32_t, int32_t)); 44 MOCK_METHOD2(LoadSystemAbility, int32_t(int32_t, const sptr<ISystemAbilityLoadCallback> &)); 45 MOCK_METHOD3(LoadSystemAbility, int32_t(int32_t, const std::string &, const sptr<ISystemAbilityLoadCallback> &)); 46 MOCK_METHOD1(UnloadSystemAbility, int32_t(int32_t)); 47 MOCK_METHOD1(CancelUnloadSystemAbility, int32_t(int32_t)); 48 MOCK_METHOD1(GetRunningSystemProcess, int32_t(std::list<SystemProcessInfo> &)); 49 MOCK_METHOD1(SubscribeSystemProcess, int32_t(const sptr<ISystemProcessStatusChange> &)); 50 MOCK_METHOD4(SendStrategy, int32_t(int32_t, std::vector<int32_t> &, int32_t, std::string &)); 51 MOCK_METHOD1(UnSubscribeSystemProcess, int32_t(const sptr<ISystemProcessStatusChange> &)); 52 MOCK_METHOD2(GetOnDemandReasonExtraData, int32_t(int64_t, MessageParcel &)); 53 MOCK_METHOD2(GetSystemProcessInfo, int32_t(int32_t, SystemProcessInfo &)); 54 MOCK_METHOD3(GetOnDemandPolicy, int32_t(int32_t, OnDemandPolicyType, std::vector<SystemAbilityOnDemandEvent> &)); 55 MOCK_METHOD3( 56 UpdateOnDemandPolicy, int32_t(int32_t, OnDemandPolicyType, const std::vector<SystemAbilityOnDemandEvent> &)); 57 MOCK_METHOD1(GetOnDemandSystemAbilityIds, int32_t(std::vector<int32_t> &)); 58 MOCK_METHOD0(UnloadAllIdleSystemAbility, int32_t()); 59 MOCK_METHOD2(GetExtensionSaIds, int32_t(const std::string&, std::vector<int32_t> &)); 60 MOCK_METHOD2(GetExtensionRunningSaList, int32_t(const std::string&, std::vector<sptr<IRemoteObject>>&)); 61 MOCK_METHOD2(GetRunningSaExtensionInfoList, int32_t(const std::string&, std::vector<SaExtensionInfo>&)); 62 MOCK_METHOD3(GetCommonEventExtraDataIdlist, int32_t(int32_t, std::vector<int64_t>&, const std::string&)); 63 }; 64 } // namespace AppExecFwk 65 } // namespace OHOS 66 #endif // OHOS_APPEXECFWk_MOCK_SYSTEM_ABILITY_MANAGER_H