1 /* 2 * Copyright (c) 2025 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_RUNTIME_H 17 #define MOCK_RUNTIME_H 18 19 #include "mock_my_flag.h" 20 #include "runtime.h" 21 22 namespace OHOS { 23 namespace AbilityRuntime { 24 class MockRuntime : public Runtime { 25 public: MockRuntime()26 MockRuntime() {} ~MockRuntime()27 ~MockRuntime() {} 28 GetLanguage()29 Language GetLanguage() const override 30 { 31 return language_; 32 } 33 StartDebugMode(const DebugOption debugOption)34 void StartDebugMode(const DebugOption debugOption) override {} SetDebugOption(const DebugOption debugOption)35 void SetDebugOption(const DebugOption debugOption) override {} StartLocalDebugMode(bool isDebugFromLocal)36 void StartLocalDebugMode(bool isDebugFromLocal) override {} DumpHeapSnapshot(bool isPrivate)37 void DumpHeapSnapshot(bool isPrivate) override {} DumpCpuProfile()38 void DumpCpuProfile() override {} DestroyHeapProfiler()39 void DestroyHeapProfiler() override {} ForceFullGC()40 void ForceFullGC() override {} ForceFullGC(uint32_t tid)41 void ForceFullGC(uint32_t tid) override {} 42 void DumpHeapSnapshot(uint32_t tid, bool isFullGC, bool isBinary = false) override {} AllowCrossThreadExecution()43 void AllowCrossThreadExecution() override {} GetHeapPrepare()44 void GetHeapPrepare() override {} NotifyApplicationState(bool isBackground)45 void NotifyApplicationState(bool isBackground) override {} SuspendVM(uint32_t tid)46 bool SuspendVM(uint32_t tid) override { return false; } ResumeVM(uint32_t tid)47 void ResumeVM(uint32_t tid) override {} PreloadSystemModule(const std::string & moduleName)48 void PreloadSystemModule(const std::string& moduleName) override {} PreloadMainAbility(const std::string & moduleName,const std::string & srcPath,const std::string & hapPath,bool isEsMode,const std::string & srcEntrance)49 void PreloadMainAbility(const std::string& moduleName, const std::string& srcPath, 50 const std::string& hapPath, bool isEsMode, const std::string& srcEntrance) override {} PreloadModule(const std::string & moduleName,const std::string & srcPath,const std::string & hapPath,bool isEsMode,bool useCommonTrunk)51 void PreloadModule(const std::string& moduleName, const std::string& srcPath, 52 const std::string& hapPath, bool isEsMode, bool useCommonTrunk) override {} FinishPreload()53 void FinishPreload() override {} LoadRepairPatch(const std::string & patchFile,const std::string & baseFile)54 bool LoadRepairPatch(const std::string& patchFile, const std::string& baseFile) override { return false; } NotifyHotReloadPage()55 bool NotifyHotReloadPage() override { return false; } UnLoadRepairPatch(const std::string & patchFile)56 bool UnLoadRepairPatch(const std::string& patchFile) override { return false; } RegisterQuickFixQueryFunc(const std::map<std::string,std::string> & moduleAndPath)57 void RegisterQuickFixQueryFunc(const std::map<std::string, std::string>& moduleAndPath) override {} StartProfiler(const DebugOption debugOption)58 void StartProfiler(const DebugOption debugOption) override {} SetExtensionApiCheckCallback(const std::function<bool (const std::string & className,const std::string & fileName)> & cb)59 void SetExtensionApiCheckCallback( 60 const std::function<bool(const std::string &className, const std::string &fileName)> &cb) override {} SetDeviceDisconnectCallback(const std::function<bool ()> & cb)61 void SetDeviceDisconnectCallback(const std::function<bool()> &cb) override {} SetLanguage(const Runtime::Language & language)62 void SetLanguage(const Runtime::Language& language) { language_ = language; } 63 private: 64 Runtime::Language language_ = Runtime::Language::JS; 65 }; 66 } // namespace AbilityRuntime 67 } // namespace OHOS 68 #endif // MOCK_RUNTIME_H