1/* 2 * Copyright (c) 2022 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 16import { paramMock } from "../utils" 17 18export function mockHidebug() { 19 const hidebug = { 20 getNativeHeapSize: function () { 21 console.warn("hidebug.getNativeHeapSize interface mocked in the Previewer. How this interface works on the" + 22 " Previewer may be different from that on a real device.") 23 return paramMock.paramNumberMock; 24 }, 25 getNativeHeapAllocatedSize: function () { 26 console.warn("hidebug.getNativeHeapAllocatedSize interface mocked in the Previewer. How this interface works on the" + 27 " Previewer may be different from that on a real device.") 28 return paramMock.paramNumberMock; 29 }, 30 getNativeHeapFreeSize: function () { 31 console.warn("hidebug.getNativeHeapFreeSize interface mocked in the Previewer. How this interface works on the" + 32 " Previewer may be different from that on a real device.") 33 return paramMock.paramNumberMock; 34 }, 35 getPss: function () { 36 console.warn("hidebug.getPss interface mocked in the Previewer. How this interface works on the" + 37 " Previewer may be different from that on a real device.") 38 return paramMock.paramNumberMock; 39 }, 40 getSharedDirty: function () { 41 console.warn("hidebug.getSharedDirty interface mocked in the Previewer. How this interface works on the" + 42 " Previewer may be different from that on a real device.") 43 return paramMock.paramNumberMock; 44 }, 45 getPrivateDirty: function () { 46 console.warn("hidebug.getPrivateDirty interface mocked in the Previewer. How this interface works on the" + 47 " Previewer may be different from that on a real device.") 48 return paramMock.paramNumberMock; 49 }, 50 getCpuUsage: function () { 51 console.warn("hidebug.getCpuUsage interface mocked in the Previewer. How this interface works on the" + 52 " Previewer may be different from that on a real device.") 53 return paramMock.paramNumberMock; 54 }, 55 startProfiling: function (...args) { 56 console.warn("hidebug.startProfiling interface mocked in the Previewer. How this interface works on the" + 57 " Previewer may be different from that on a real device.") 58 }, 59 stopProfiling: function () { 60 console.warn("hidebug.stopProfiling interface mocked in the Previewer. How this interface works on the" + 61 " Previewer may be different from that on a real device.") 62 }, 63 dumpHeapData: function (...args) { 64 console.warn("hidebug.dumpHeapData interface mocked in the Previewer. How this interface works on the" + 65 " Previewer may be different from that on a real device.") 66 }, 67 getServiceDump: function (...args) { 68 console.warn("hidebug.getServiceDump interface mocked in the Previewer. How this interface works on the" + 69 " Previewer may be different from that on a real device.") 70 return paramMock.paramStringMock; 71 }, 72 } 73 return hidebug 74}