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 mockHiChecker() { 19 const RULE_CAUTION_PRINT_LOG = paramMock.paramNumberMock; 20 const RULE_CAUTION_TRIGGER_CRASH = paramMock.paramNumberMock; 21 const RULE_THREAD_CHECK_SLOW_PROCESS = paramMock.paramNumberMock; 22 const RULE_CHECK_ABILITY_CONNECTION_LEAK = paramMock.paramNumberMock; 23 const hichecker = { 24 RULE_CAUTION_PRINT_LOG, 25 RULE_CAUTION_TRIGGER_CRASH, 26 RULE_THREAD_CHECK_SLOW_PROCESS, 27 RULE_CHECK_ABILITY_CONNECTION_LEAK, 28 addRule: function(...args) { 29 console.warn("hichecker.addRule interface mocked in the Previewer. How this interface works on the Previewer" + 30 " may be different from that on a real device.") 31 }, 32 removeRule: function(...args) { 33 console.warn("hichecker.removeRule interface mocked in the Previewer. How this interface works on the Previewer" + 34 " may be different from that on a real device.") 35 }, 36 getRule: function(...args) { 37 console.warn("hichecker.getRule interface mocked in the Previewer. How this interface works on the Previewer" + 38 " may be different from that on a real device.") 39 return paramMock.paramNumberMock; 40 }, 41 contains: function(...args) { 42 console.warn("hichecker.contains interface mocked in the Previewer. How this interface works on the Previewer" + 43 " may be different from that on a real device.") 44 return paramMock.paramBooleanMock; 45 }, 46 } 47 return hichecker 48} 49