/* * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef FOUNDATION_APPEXECFWK_SERVICES_FORMMGR_INCLUDE_FORM_MGR_SERVICE_H #define FOUNDATION_APPEXECFWK_SERVICES_FORMMGR_INCLUDE_FORM_MGR_SERVICE_H #include #include #include #include #include #include #include "form_mgr_stub.h" #include "form_provider_data.h" #include "iremote_object.h" namespace OHOS { namespace AppExecFwk { /** * @class MockFormMgrService */ class MockFormMgrService : public FormMgrStub, public std::enable_shared_from_this { public: MockFormMgrService() = default; virtual~MockFormMgrService() = default; int32_t AddForm(const int64_t formId, const Want &want, const sptr &callerToken, FormJsInfo &formInfo) override { return ERR_OK; }; int32_t DeleteForm(const int64_t formId, const sptr &callerToken) override { return ERR_OK; }; int32_t ReleaseForm(const int64_t formId, const sptr &callerToken, const bool delCache) override { return ERR_OK; }; int32_t UpdateForm(const int64_t formId, const FormProviderData &FormProviderData) override { return ERR_OK; }; int32_t SetNextRefreshTime(const int64_t formId, const int64_t nextTime) override { return ERR_OK; }; int32_t LifecycleUpdate(const std::vector &formIds, const sptr &callerToken, const bool updateType) override { return ERR_OK; }; ErrCode RequestPublishForm(Want &want, bool withFormBindingData, std::unique_ptr &formBindingData, int64_t &formId) override { return ERR_OK; }; int32_t RequestForm(const int64_t formId, const sptr &callerToken, const Want &want) override { return ERR_OK; }; int32_t NotifyWhetherVisibleForms(const std::vector &formIds, const sptr &callerToken, const int32_t formVisibleType) override { return ERR_OK; }; int32_t CastTempForm(const int64_t formId, const sptr &callerToken) override { return ERR_OK; }; int32_t DumpStorageFormInfos(std::string &formInfos) override { return ERR_OK; }; int32_t DumpFormInfoByBundleName(const std::string &bundleName, std::string &formInfos) override { return ERR_OK; }; int32_t DumpFormInfoByFormId(const std::int64_t formId, std::string &formInfo) override { return ERR_OK; }; int32_t DumpFormTimerByFormId(const std::int64_t formId, std::string &isTimingService) override { return ERR_OK; }; int32_t MessageEvent(const int64_t formId, const Want &want, const sptr &callerToken) override { return ERR_OK; }; int32_t RouterEvent(const int64_t formId, Want &want, const sptr &callerToken) override { return ERR_OK; }; int32_t BackgroundEvent(const int64_t formId, Want &want, const sptr &callerToken) override { return ERR_OK; }; int32_t DeleteInvalidForms(const std::vector &formIds, const sptr &callerToken, int32_t &numFormsDeleted) override { return ERR_OK; }; int32_t AcquireFormState(const Want &want, const sptr &callerToken, FormStateInfo &stateInfo) override { return ERR_OK; }; int32_t NotifyFormsVisible(const std::vector &formIds, bool isVisible, const sptr &callerToken) override { return ERR_OK; }; int32_t NotifyFormsPrivacyProtected(const std::vector &formIds, bool isProtected, const sptr &callerToken) override { return ERR_OK; }; int32_t NotifyFormsEnableUpdate(const std::vector &formIds, bool isEnableUpdate, const sptr &callerToken) override { return ERR_OK; }; int32_t GetAllFormsInfo(std::vector &formInfos) override { return ERR_OK; }; int32_t GetFormsInfoByApp(std::string &bundleName, std::vector &formInfos) override { return ERR_OK; }; int32_t GetFormsInfoByModule(std::string &bundleName, std::string &moduleName, std::vector &formInfos) override { return ERR_OK; }; int32_t ShareForm(const int64_t formId, const std::string &deviceId, const sptr &callerToken, const int64_t requestCode) override { return ERR_OK; }; int32_t AcquireFormData(int64_t formId, int64_t requestCode, const sptr &callerToken, AAFwk::WantParams &formData) override { return ERR_OK; }; int32_t RecvFormShareInfoFromRemote(const FormShareInfo &info) override { return ERR_OK; }; bool IsRequestPublishFormSupported() override { return true; }; int32_t StartAbility(const Want &want, const sptr &callerToken) override { return ERR_OK; }; int32_t GetFormsInfo(const FormInfoFilter &filter, std::vector &formInfos) override { return ERR_OK; }; bool CheckFMSReady() override { return false; }; int32_t SetBackgroundFunction(const std::string method, const std::string params) override { return ERR_OK; }; int32_t GetFormsCount(bool isTempFormFlag, int32_t &formCount) override { return ERR_OK; } int32_t GetHostFormsCount(std::string &bundleName, int32_t &formCount) override { return ERR_OK; } ErrCode GetRunningFormInfos(bool isUnusedIncluded, std::vector &runningFormInfos) override { return ERR_OK; } ErrCode GetRunningFormInfosByBundleName( const std::string &bundleName, bool isUnusedIncluded, std::vector &runningFormInfos) override { return ERR_OK; } int32_t GetFormInstancesByFilter(const FormInstancesFilter &formInstancesFilter, std::vector &formInstances) override { return 0; } int32_t GetFormInstanceById(const int64_t formId, FormInstance &formInstance) override { return 0; } ErrCode RegisterFormAddObserverByBundle(const std::string bundleName, const sptr &callerToken) override { return ERR_OK; } ErrCode RegisterFormRemoveObserverByBundle(const std::string bundleName, const sptr &callerToken) override { return ERR_OK; } ErrCode RegisterAddObserver(const std::string &bundleName, const sptr &callerToken) override { return ERR_OK; } ErrCode RegisterRemoveObserver(const std::string &bundleName, const sptr &callerToken) override { return ERR_OK; } ErrCode RegisterFormRouterProxy(const std::vector &formIds, const sptr &callerToken) override { return ERR_OK; } ErrCode UnregisterFormRouterProxy(const std::vector &formIds) override { return ERR_OK; } ErrCode RegisterClickEventObserver( const std::string &bundleName, const std::string &formEventType, const sptr &observer) override { return ERR_OK; } ErrCode UnregisterClickEventObserver( const std::string &bundleName, const std::string &formEventType, const sptr &observer) override { return ERR_OK; } }; } // namespace AppExecFwk } // namespace OHOS #endif // FOUNDATION_APPEXECFWK_SERVICES_FORMMGR_INCLUDE_FORM_MGR_SERVICE_H