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 #include "js_ability.h" 17 #include "MockGlobalResult.h" 18 19 namespace OHOS { 20 namespace ACELite { ~JSAbility()21 JSAbility::~JSAbility() {} 22 Launch(const char * abilityPath,const char * bundleName,uint16_t token,const char * pageInfo)23 void JSAbility::Launch(const char *abilityPath, const char *bundleName, uint16_t token, const char*pageInfo) 24 { 25 g_jsAbilityLaunch = true; 26 } 27 Show()28 void JSAbility::Show() 29 { 30 g_jsAbilityShow = true; 31 } 32 Hide()33 void JSAbility::Hide() 34 { 35 g_jsAbilityHide = true; 36 } 37 TransferToDestroy()38 void JSAbility::TransferToDestroy() 39 { 40 g_jsAbilityTransferToDestroy = true; 41 } 42 operator new(size_t size)43 void *MemoryHeap::operator new(size_t size) 44 { 45 if (size > 1024) { // 1024 is maxSize for test 46 return nullptr; 47 } 48 return malloc(size); 49 } 50 operator new[](size_t size)51 void *MemoryHeap::operator new[](size_t size) 52 { 53 if (size > 1024) { // 1024 is maxSize for test 54 return nullptr; 55 } 56 return malloc(size); 57 } 58 operator delete(void * p)59 void MemoryHeap::operator delete(void *p) 60 { 61 free(p); 62 } 63 operator delete[](void * p)64 void MemoryHeap::operator delete[](void *p) 65 { 66 free(p); 67 } 68 } 69 }