• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
22 namespace OHOS {
23 namespace AppExecFwk {
24 class AppMgrClientMock : public AppMgrClient {
25 public:
26     DECLARE_INTERFACE_DESCRIPTOR(u"AppMgrClientMock");
AppMgrClientMock()27     AppMgrClientMock()
28     {}
~AppMgrClientMock()29     virtual ~AppMgrClientMock()
30     {}
31     MOCK_METHOD0(ConnectAppMgrService, AppMgrResultCode());
32     MOCK_METHOD1(RegisterAppStateCallback, AppMgrResultCode(const sptr<IAppStateCallback> &callback));
33     MOCK_METHOD5(LoadAbility, AppMgrResultCode(const sptr<IRemoteObject>&, const sptr<IRemoteObject>&,
34         const AbilityInfo&, const ApplicationInfo&, const AAFwk::Want&));
35     MOCK_METHOD2(TerminateAbility, AppMgrResultCode(const sptr<IRemoteObject>&, bool));
36     MOCK_METHOD2(UpdateExtensionState, AppMgrResultCode(const sptr<IRemoteObject> &token, const ExtensionState state));
37     MOCK_METHOD2(UpdateApplicationInfoInstalled, AppMgrResultCode(const std::string &bundleName, const int uid));
38     MOCK_METHOD1(KillApplication, AppMgrResultCode(const std::string&));
39     MOCK_METHOD2(KillApplicationByUid, AppMgrResultCode(const std::string &bundleName, const int uid));
40     MOCK_METHOD1(ClearUpApplicationData, AppMgrResultCode(const std::string&));
41     MOCK_METHOD1(StartupResidentProcess, void(const std::vector<AppExecFwk::BundleInfo> &bundleInfos));
42     MOCK_METHOD2(StartSpecifiedAbility, void(const AAFwk::Want &want, const AppExecFwk::AbilityInfo &abilityInfo));
43     MOCK_METHOD1(GetAllRunningProcesses, AppMgrResultCode(std::vector<RunningProcessInfo> &info));
44     MOCK_METHOD2(GetProcessRunningInfosByUserId, AppMgrResultCode(
45         std::vector<RunningProcessInfo> &info, int32_t userId));
46     MOCK_METHOD4(StartUserTestProcess, int(
47         const AAFwk::Want &want, const sptr<IRemoteObject> &observer, const BundleInfo &bundleInfo, int32_t userId));
48     MOCK_METHOD3(FinishUserTest, int(
49         const std::string &msg, const int64_t &resultCode, const std::string &bundleName));
50     MOCK_METHOD1(UpdateConfiguration, AppMgrResultCode(const Configuration &config));
51     MOCK_METHOD1(GetConfiguration, AppMgrResultCode(Configuration& config));
52     MOCK_METHOD2(GetAbilityRecordsByProcessID, int(
53         const int pid, std::vector<sptr<IRemoteObject>> &tokens));
54     MOCK_METHOD0(BlockAppService, AppMgrResultCode());
55 };
56 }  // namespace AppExecFwk
57 }  // namespace OHOS
58 #endif  // MODULETEST_OHOS_ABILITY_RUNTIME_MOCK_APP_MGR_CLIENT_H
59