1 /* 2 * Copyright (c) 2024 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 MOCK_OHOS_ABILITY_RUNTIME_MOCK_APP_SCHEDULER_CLIENT_H 17 #define MOCK_OHOS_ABILITY_RUNTIME_MOCK_APP_SCHEDULER_CLIENT_H 18 19 #include "gmock/gmock.h" 20 #include "refbase.h" 21 #include "iremote_object.h" 22 #include "app_scheduler_proxy.h" 23 #include "app_launch_data.h" 24 #include "app_malloc_info.h" 25 26 namespace OHOS { 27 namespace AppExecFwk { 28 class MockAppSchedulerClient : public AppSchedulerProxy { 29 public: MockAppSchedulerClient(const sptr<IRemoteObject> & impl)30 MockAppSchedulerClient(const sptr<IRemoteObject> &impl) : AppSchedulerProxy(impl) {} 31 virtual ~MockAppSchedulerClient() = default; 32 MOCK_METHOD0(ScheduleForegroundApplication, bool()); 33 MOCK_METHOD0(ScheduleBackgroundApplication, void()); 34 MOCK_METHOD1(ScheduleTerminateApplication, void(bool)); 35 MOCK_METHOD2(ScheduleLaunchApplication, void(const AppLaunchData&, const Configuration& config)); 36 MOCK_METHOD4(ScheduleLaunchAbility, void(const AbilityInfo&, const sptr<IRemoteObject>&, 37 const std::shared_ptr<AAFwk::Want>&, int32_t)); 38 MOCK_METHOD2(ScheduleCleanAbility, void(const sptr<IRemoteObject>&, bool)); 39 MOCK_METHOD1(ScheduleProfileChanged, void(const Profile&)); 40 MOCK_METHOD1(ScheduleConfigurationUpdated, void(const Configuration& config)); 41 MOCK_METHOD1(ScheduleShrinkMemory, void(const int)); 42 MOCK_METHOD0(ScheduleLowMemory, void()); 43 MOCK_METHOD0(ScheduleProcessSecurityExit, void()); 44 MOCK_METHOD1(ScheduleAbilityStage, void(const HapModuleInfo&)); 45 MOCK_METHOD2(ScheduleUpdateApplicationInfoInstalled, void(const ApplicationInfo&, const std::string&)); 46 MOCK_METHOD1(ScheduleMemoryLevel, void(int32_t level)); 47 MOCK_METHOD2(ScheduleHeapMemory, void(const int32_t pid, OHOS::AppExecFwk::MallocInfo &mallocInfo)); 48 MOCK_METHOD2(ScheduleAcceptWant, void(const AAFwk::Want& want, const std::string& moduleName)); 49 MOCK_METHOD1(SchedulePrepareTerminate, void(const std::string &moduleName)); 50 MOCK_METHOD2(ScheduleNewProcessRequest, void(const AAFwk::Want& want, const std::string& moduleName)); 51 MOCK_METHOD3(ScheduleNotifyLoadRepairPatch, int32_t(const std::string& bundleName, 52 const sptr<IQuickFixCallback>& callback, const int32_t recordId)); 53 MOCK_METHOD2(ScheduleNotifyHotReloadPage, int32_t(const sptr<IQuickFixCallback>& callback, const int32_t recordId)); 54 MOCK_METHOD3(ScheduleNotifyUnLoadRepairPatch, int32_t(const std::string& bundleName, 55 const sptr<IQuickFixCallback>& callback, const int32_t recordId)); 56 MOCK_METHOD1(ScheduleNotifyAppFault, int32_t(const FaultData &faultData)); 57 MOCK_METHOD2(ScheduleChangeAppGcState, int32_t(int32_t state, uint64_t tid)); 58 MOCK_METHOD1(AttachAppDebug, void(bool isDebugFromLocal)); 59 MOCK_METHOD0(DetachAppDebug, void()); 60 MOCK_METHOD1(ScheduleJsHeapMemory, void(OHOS::AppExecFwk::JsHeapDumpInfo &info)); 61 MOCK_METHOD2(SetAppWaitingDebug, int32_t(const std::string &bundleName, bool isPersist)); 62 MOCK_METHOD0(CancelAppWaitingDebug, int32_t()); 63 MOCK_METHOD1(GetWaitingDebugApp, int32_t(std::vector<std::string> &debugInfoList)); 64 MOCK_METHOD1(IsWaitingDebugApp, bool(const std::string &bundleName)); 65 MOCK_METHOD0(ClearNonPersistWaitingDebugFlag, void()); 66 MOCK_METHOD1(ScheduleDumpIpcStart, int32_t(std::string &result)); 67 MOCK_METHOD1(ScheduleDumpIpcStop, int32_t(std::string &result)); 68 MOCK_METHOD1(ScheduleDumpIpcStat, int32_t(std::string &result)); 69 MOCK_METHOD1(ScheduleDumpFfrt, int32_t(std::string& result)); 70 MOCK_METHOD0(ScheduleClearPageStack, void()); 71 MOCK_METHOD0(IsMemorySizeSufficent, bool()); 72 MOCK_METHOD0(ScheduleCacheProcess, void()); 73 }; 74 } // namespace AppExecFwk 75 } // namespace OHOS 76 #endif // MOCK_OHOS_ABILITY_RUNTIME_MOCK_APP_SCHEDULER_CLIENT_H 77