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 SYSTEM_ABILITY_MANAGER_MOCK_H 17 #define SYSTEM_ABILITY_MANAGER_MOCK_H 18 19 #include <gmock/gmock.h> 20 21 #include "iremote_object.h" 22 #include "if_system_ability_manager.h" 23 24 namespace OHOS { 25 class SystemAbilityManagerMock : public ISystemAbilityManager { 26 public: 27 SystemAbilityManagerMock(); 28 ~SystemAbilityManagerMock(); 29 static SystemAbilityManagerMock *GetMock(); 30 31 MOCK_METHOD(sptr<IRemoteObject>, CheckSystemAbility, (int32_t systemAbilityId), (override)); 32 MOCK_METHOD(int32_t, LoadSystemAbility, (int32_t systemAbilityId, const sptr<ISystemAbilityLoadCallback> &callback), 33 (override)); 34 35 private: 36 static inline SystemAbilityManagerMock *mock_ = nullptr; 37 }; 38 39 class SystemAbilityManager : public ISystemAbilityManager { 40 public: 41 sptr<IRemoteObject> CheckSystemAbility(int32_t systemAbilityId) override; 42 int32_t LoadSystemAbility(int32_t systemAbilityId, const sptr<ISystemAbilityLoadCallback> &callback) override; 43 }; 44 } // namespace OHOS 45 #endif // SYSTEM_ABILITY_MANAGER_MOCK_H 46