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 FOUNDATION_AAFWK_SERVICES_ABILITY_TEST_MOCK_APP_MGR_CLIENT_H 17 #define FOUNDATION_AAFWK_SERVICES_ABILITY_TEST_MOCK_APP_MGR_CLIENT_H 18 19 #include "gmock/gmock.h" 20 #include "app_mgr_client.h" 21 #include "hilog_wrapper.h" 22 23 namespace OHOS { 24 namespace AAFwk { 25 using namespace OHOS::AppExecFwk; 26 class MockAppMgrClient : public AppMgrClient { 27 public: MockAppMgrClient()28 MockAppMgrClient(){}; ~MockAppMgrClient()29 virtual ~MockAppMgrClient(){}; 30 LoadAbility(const sptr<IRemoteObject> & token,const sptr<IRemoteObject> & preToken,const AbilityInfo & abilityInfo,const ApplicationInfo & appInfo)31 virtual AppMgrResultCode LoadAbility(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &preToken, 32 const AbilityInfo &abilityInfo, const ApplicationInfo &appInfo) 33 { 34 HILOG_INFO("MockAppMgrClient LoadAbility enter."); 35 token_ = token; 36 return AppMgrResultCode::RESULT_OK; 37 } 38 GetToken()39 sptr<IRemoteObject> GetToken() 40 { 41 return token_; 42 }; 43 44 private: 45 sptr<IRemoteObject> token_; 46 }; 47 } // namespace AAFwk 48 } // namespace OHOS 49 #endif // FOUNDATION_AAFWK_SERVICES_ABILITY_TEST_MOCK_APP_MGR_CLIENT_H 50