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 #ifndef SECURITY_COMPONENT_MOCK_SYSTEM_ABILITY_MANAGER_PROXY 16 #define SECURITY_COMPONENT_MOCK_SYSTEM_ABILITY_MANAGER_PROXY 17 #include <string> 18 #ifndef FUZZ_ENABLE 19 #include <gmock/gmock.h> 20 #endif // FUZZ_ENABLE 21 #include "if_system_ability_manager.h" 22 23 namespace OHOS { 24 class SystemAbilityManagerProxy : public IRemoteProxy<ISystemAbilityManager> { 25 public: SystemAbilityManagerProxy(const sptr<IRemoteObject> & impl)26 explicit SystemAbilityManagerProxy(const sptr<IRemoteObject>& impl) 27 : IRemoteProxy<ISystemAbilityManager>(impl) {} 28 ~SystemAbilityManagerProxy() = default; 29 #ifndef FUZZ_ENABLE 30 MOCK_METHOD1(GetSystemAbility, sptr<MockIRemoteObject>(int32_t)); 31 MOCK_METHOD1(UnloadSystemAbility, int32_t(int32_t)); 32 #else GetSystemAbility(int32_t saId)33 sptr<MockIRemoteObject> GetSystemAbility(int32_t saId) 34 { 35 sptr<MockIRemoteObject> object = new MockIRemoteObject(); 36 return object; 37 } 38 UnloadSystemAbility(int32_t saId)39 int32_t UnloadSystemAbility(int32_t saId) 40 { 41 return 0; 42 } 43 #endif // FUZZ_ENABLE 44 }; 45 } // namespace OHOS 46 #endif 47