• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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_DM_SYSTEM_ABILITY_MANAGER_H
17 #define OHOS_DM_SYSTEM_ABILITY_MANAGER_H
18 
19 #include <gmock/gmock.h>
20 
21 #include "if_system_ability_manager.h"
22 
23 namespace OHOS {
24 namespace DistributedHardware {
25 class SystemAbilityManagerMock : public ISystemAbilityManager {
26 public:
27     MOCK_METHOD0(AsObject, sptr<IRemoteObject>());
28     MOCK_METHOD1(ListSystemAbilities, std::vector<std::u16string>(unsigned int dumpFlags));
29     MOCK_METHOD1(GetSystemAbility, sptr<IRemoteObject>(int32_t systemAbilityId));
30     MOCK_METHOD1(CheckSystemAbility, sptr<IRemoteObject>(int32_t systemAbilityId));
31     MOCK_METHOD1(RemoveSystemAbility, int32_t(int32_t systemAbilityId));
32     MOCK_METHOD2(SubscribeSystemAbility, int32_t(int32_t systemAbilityId,
33         const sptr<ISystemAbilityStatusChange>& listener));
34     MOCK_METHOD2(UnSubscribeSystemAbility, int32_t(int32_t systemAbilityId,
35         const sptr<ISystemAbilityStatusChange>& listener));
36     MOCK_METHOD2(GetSystemAbility, sptr<IRemoteObject>(int32_t systemAbilityId, const std::string& deviceId));
37     MOCK_METHOD2(CheckSystemAbility, sptr<IRemoteObject>(int32_t systemAbilityId, const std::string& deviceId));
38     MOCK_METHOD2(AddOnDemandSystemAbilityInfo, int32_t(int32_t systemAbilityId,
39         const std::u16string& localAbilityManagerName));
40     MOCK_METHOD2(CheckSystemAbility, sptr<IRemoteObject>(int32_t systemAbilityId, bool& isExist));
41     MOCK_METHOD3(AddSystemAbility, int32_t(int32_t systemAbilityId, const sptr<IRemoteObject>& ability,
42         const SAExtraProp& extraProp));
43     MOCK_METHOD2(AddSystemProcess, int32_t(const std::u16string& procName, const sptr<IRemoteObject>& procObject));
44     MOCK_METHOD2(LoadSystemAbility, sptr<IRemoteObject>(int32_t systemAbilityId, int32_t timeout));
45     MOCK_METHOD2(LoadSystemAbility, int32_t(int32_t systemAbilityId, const sptr<ISystemAbilityLoadCallback>& callback));
46     MOCK_METHOD3(LoadSystemAbility, int32_t(int32_t systemAbilityId, const std::string& deviceId,
47         const sptr<ISystemAbilityLoadCallback>& callback));
48     MOCK_METHOD1(UnloadSystemAbility, int32_t(int32_t systemAbilityId));
49     MOCK_METHOD1(CancelUnloadSystemAbility, int32_t(int32_t systemAbilityId));
50     MOCK_METHOD0(UnloadAllIdleSystemAbility, int32_t());
51     MOCK_METHOD2(GetSystemProcessInfo, int32_t(int32_t systemAbilityId, SystemProcessInfo& systemProcessInfo));
52     MOCK_METHOD1(GetRunningSystemProcess, int32_t(std::list<SystemProcessInfo>& systemProcessInfos));
53     MOCK_METHOD1(SubscribeSystemProcess, int32_t(const sptr<ISystemProcessStatusChange>& listener));
54     MOCK_METHOD4(SendStrategy, int32_t(int32_t type, std::vector<int32_t>& systemAbilityIds,
55         int32_t level, std::string& action));
56     MOCK_METHOD1(UnSubscribeSystemProcess, int32_t(const sptr<ISystemProcessStatusChange>& listener));
57     MOCK_METHOD2(GetOnDemandReasonExtraData, int32_t(int64_t extraDataId, MessageParcel& extraDataParcel));
58     MOCK_METHOD3(GetOnDemandPolicy, int32_t(int32_t systemAbilityId, OnDemandPolicyType type,
59         std::vector<SystemAbilityOnDemandEvent>& abilityOnDemandEvents));
60     MOCK_METHOD3(UpdateOnDemandPolicy, int32_t(int32_t systemAbilityId, OnDemandPolicyType type,
61         const std::vector<SystemAbilityOnDemandEvent>& abilityOnDemandEvents));
62     MOCK_METHOD1(GetOnDemandSystemAbilityIds, int32_t(std::vector<int32_t>& systemAbilityIds));
63     MOCK_METHOD2(GetExtensionSaIds, int32_t(const std::string& extension, std::vector<int32_t> &saIds));
64     MOCK_METHOD2(GetExtensionRunningSaList, int32_t(const std::string& extension,
65         std::vector<sptr<IRemoteObject>>& saList));
66     MOCK_METHOD2(GetRunningSaExtensionInfoList, int32_t(const std::string& extension,
67         std::vector<SaExtensionInfo>& infoList));
68     MOCK_METHOD3(GetCommonEventExtraDataIdlist, int32_t(int32_t systemAbilityId,
69         std::vector<int64_t>& extraDataIdList, const std::string& eventName));
70     MOCK_METHOD1(GetLocalAbilityManagerProxy, sptr<IRemoteObject>(int32_t));
71 };
72 }
73 } // namespace OHOS
74 
75 #endif // OHOS_DM_SYSTEM_ABILITY_MANAGER_H
76