1 /* 2 * Copyright (c) 2021-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 16 #ifndef MODULETEST_OHOS_ABILITY_RUNTIME_MOCK_APP_SCHEDULER_H 17 #define MODULETEST_OHOS_ABILITY_RUNTIME_MOCK_APP_SCHEDULER_H 18 19 #include "gmock/gmock.h" 20 #include "refbase.h" 21 #include "iremote_object.h" 22 #include "app_scheduler.h" 23 #include "app_launch_data.h" 24 #include "configuration.h" 25 #include "app_malloc_info.h" 26 27 namespace OHOS { 28 namespace AAFwk { 29 class MockAppScheduler : public AppScheduler { 30 public: 31 MockAppScheduler() = default; 32 virtual ~MockAppScheduler() = default; 33 34 MOCK_METHOD0(ScheduleForegroundApplication, bool()); 35 MOCK_METHOD0(ScheduleBackgroundApplication, void()); 36 MOCK_METHOD1(ScheduleTerminateApplication, void(bool)); 37 MOCK_METHOD2(ScheduleLaunchApplication, void(const AppExecFwk::AppLaunchData&, const Configuration& config)); 38 MOCK_METHOD4(ScheduleLaunchAbility, void(const AppExecFwk::AbilityInfo&, const sptr<IRemoteObject>&, 39 const std::shared_ptr<AAFwk::Want>&, int32_t)); 40 MOCK_METHOD2(ScheduleCleanAbility, void(const sptr<IRemoteObject>&, bool)); 41 MOCK_METHOD1(ScheduleProfileChanged, void(const AppExecFwk::Profile&)); 42 MOCK_METHOD1(ScheduleConfigurationUpdated, void(const AppExecFwk::Configuration& config)); 43 MOCK_METHOD1(ScheduleShrinkMemory, void(const int)); 44 MOCK_METHOD1(ScheduleMemoryLevel, void(int32_t level)); 45 MOCK_METHOD2(ScheduleHeapMemory, void(const int32_t pid, OHOS::AppExecFwk::MallocInfo &mallocInfo)); 46 MOCK_METHOD0(ScheduleLowMemory, void()); 47 MOCK_METHOD1(ScheduleNotifyAppFault, int32_t(const FaultData &)); 48 MOCK_METHOD1(ScheduleChangeAppGcState, int32_t(int32_t state)); 49 MOCK_METHOD1(RegisterAppDebugListener, int32_t(const sptr<AppExecFwk::IAppDebugListener> &listener)); 50 MOCK_METHOD1(UnregisterAppDebugListener, int32_t(const sptr<AppExecFwk::IAppDebugListener> &listener)); 51 MOCK_METHOD1(AttachAppDebug, int32_t(const std::string &bundleName)); 52 MOCK_METHOD1(DetachAppDebug, int32_t(const std::string &bundleName)); 53 MOCK_METHOD1(RegisterAbilityDebugResponse, int32_t(const sptr<AppExecFwk::IAbilityDebugResponse> &response)); 54 MOCK_METHOD1(ScheduleJsHeapMemory, void(OHOS::AppExecFwk::JsHeapDumpInfo &info)); 55 }; 56 } // namespace AAFwk 57 } // namespace OHOS 58 #endif // MODULETEST_OHOS_ABILITY_RUNTIME_MOCK_APP_SCHEDULER_H 59