1/* 2 * Copyright (c) 2021 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 { AsyncCallback } from '../basic'; 17import { Ability } from '../@ohos.application.Ability' 18import { AbilityMonitor } from './abilityMonitor' 19import { Context } from '../app/context' 20import { ShellCmdResult } from './shellCmdResult' 21 22/** 23 * A global test utility interface used for adding AbilityMonitor objects and control lifecycle states of abilities. 24 * 25 * @since 8 26 * @syscap SystemCapability.Ability.AbilityRuntime.Core 27 * @import import AbilityDelegator from 'application/abilityDelegator.d' 28 * @permission N/A 29 */ 30export interface AbilityDelegator { 31 /** 32 * Prints log information to the unit testing console. 33 * The total length of the log information to be printed cannot exceed 1000 characters. 34 * 35 * @since 8 36 * @syscap SystemCapability.Ability.AbilityRuntime.Core 37 * @param msg Log information 38 */ 39 print(msg: string, callback: AsyncCallback<void>): void; 40 print(msg: string): Promise<void>; 41 42 /** 43 * Execute the given command in the aa tools side. 44 * 45 * @since 8 46 * @syscap SystemCapability.Ability.AbilityRuntime.Core 47 * @param cmd Shell command 48 * @param timeoutSecs Timeout, in seconds 49 * @return ShellCmdResult object 50 */ 51 executeShellCommand(cmd: string, callback: AsyncCallback<ShellCmdResult>): void; 52 executeShellCommand(cmd: string, timeoutSecs: number, callback: AsyncCallback<ShellCmdResult>): void; 53 executeShellCommand(cmd: string, timeoutSecs?: number): Promise<ShellCmdResult>; 54 55 /** 56 * Prints log information to the unit testing console. 57 * The total length of the log information to be printed cannot exceed 1000 characters. 58 * 59 * @since 8 60 * @syscap SystemCapability.Ability.AbilityRuntime.Core 61 * @systemapi Hide this for inner system use. 62 * @param msg Log information 63 * @param code Result code 64 */ 65 finishTest(msg: string, code: number, callback: AsyncCallback<void>): void; 66 finishTest(msg: string, code: number): Promise<void>; 67} 68 69export default AbilityDelegator;