1 /* 2 * Copyright (c) 2021-2022 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 MODULETEST_OHOS_ABILITY_RUNTIME_MOCK_APP_MGR_CLIENT_H 17 #define MODULETEST_OHOS_ABILITY_RUNTIME_MOCK_APP_MGR_CLIENT_H 18 19 #include <gmock/gmock.h> 20 #include "app_mgr_client.h" 21 #include "param.h" 22 23 namespace OHOS { 24 namespace AppExecFwk { 25 class AppMgrClientMock : public AppMgrClient { 26 public: 27 DECLARE_INTERFACE_DESCRIPTOR(u"AppMgrClientMock"); AppMgrClientMock()28 AppMgrClientMock() 29 {} ~AppMgrClientMock()30 virtual ~AppMgrClientMock() 31 {} 32 MOCK_METHOD0(ConnectAppMgrService, AppMgrResultCode()); 33 MOCK_METHOD1(RegisterAppStateCallback, AppMgrResultCode(const sptr<IAppStateCallback> &callback)); 34 MOCK_METHOD4(LoadAbility, AppMgrResultCode(const AbilityInfo&, const ApplicationInfo&, 35 const AAFwk::Want&, AbilityRuntime::LoadParam)); 36 MOCK_METHOD2(TerminateAbility, AppMgrResultCode(const sptr<IRemoteObject>&, bool)); 37 MOCK_METHOD2(UpdateExtensionState, AppMgrResultCode(const sptr<IRemoteObject> &token, const ExtensionState state)); 38 MOCK_METHOD2(UpdateApplicationInfoInstalled, AppMgrResultCode(const std::string &bundleName, const int uid)); 39 MOCK_METHOD0(UpdateApplicationInfoInstalledDone, AppMgrResultCode()); 40 MOCK_METHOD2(KillApplication, AppMgrResultCode(const std::string&, const bool clearPageStack)); 41 MOCK_METHOD3(KillApplicationByUid, 42 AppMgrResultCode(const std::string &bundleName, const int uid, const std::string&)); 43 MOCK_METHOD3(ClearUpApplicationData, AppMgrResultCode(const std::string&, int32_t appCloneIndex, int32_t userId)); 44 MOCK_METHOD1(StartupResidentProcess, void(const std::vector<AppExecFwk::BundleInfo> &bundleInfos)); 45 MOCK_METHOD3(StartSpecifiedAbility, void(const AAFwk::Want&, const AppExecFwk::AbilityInfo&, int32_t)); 46 MOCK_METHOD1(GetAllRunningProcesses, AppMgrResultCode(std::vector<RunningProcessInfo> &info)); 47 MOCK_METHOD1(GetAllRenderProcesses, AppMgrResultCode(std::vector<RenderProcessInfo> &info)); 48 MOCK_METHOD1(GetAllChildrenProcesses, AppMgrResultCode(std::vector<ChildProcessInfo> &info)); 49 MOCK_METHOD2(GetProcessRunningInfosByUserId, AppMgrResultCode( 50 std::vector<RunningProcessInfo> &info, int32_t userId)); 51 MOCK_METHOD4(StartUserTestProcess, int( 52 const AAFwk::Want &want, const sptr<IRemoteObject> &observer, const BundleInfo &bundleInfo, int32_t userId)); 53 MOCK_METHOD3(FinishUserTest, int( 54 const std::string &msg, const int64_t &resultCode, const std::string &bundleName)); 55 MOCK_METHOD2(UpdateConfiguration, AppMgrResultCode(const Configuration &config, const int32_t userId)); 56 MOCK_METHOD1(GetConfiguration, AppMgrResultCode(Configuration& config)); 57 MOCK_METHOD2(GetAbilityRecordsByProcessID, int( 58 const int pid, std::vector<sptr<IRemoteObject>> &tokens)); 59 }; 60 } // namespace AppExecFwk 61 } // namespace OHOS 62 #endif // MODULETEST_OHOS_ABILITY_RUNTIME_MOCK_APP_MGR_CLIENT_H 63