From 86044daf9a4beafd8cec90328c59b70b46328e8a Mon Sep 17 00:00:00 2001 From: njupthan Date: Fri, 1 Apr 2022 13:49:22 +0800 Subject: [PATCH 1/4] [test framework] DTS update Signed-off-by: njupthan --- ....application.abilityDelegatorRegistry.d.ts | 4 ++-- api/application/abilityDelegator.d.ts | 23 ++++++++++++++----- api/application/shellCmdResult.d.ts | 2 +- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/api/@ohos.application.abilityDelegatorRegistry.d.ts b/api/@ohos.application.abilityDelegatorRegistry.d.ts index c2fa8b68e6..cd7a48c6b1 100644 --- a/api/@ohos.application.abilityDelegatorRegistry.d.ts +++ b/api/@ohos.application.abilityDelegatorRegistry.d.ts @@ -13,8 +13,8 @@ * limitations under the License. */ -import { AbilityDelegator } from './application/abilityDelegator' -import { AbilityDelegatorArgs } from './application/abilityDelegatorArgs' +import { AbilityDelegator } from './application/abilityDelegator'; +import { AbilityDelegatorArgs } from './application/abilityDelegatorArgs'; /** * A global register used to store the AbilityDelegator and AbilityDelegatorArgs objects registered diff --git a/api/application/abilityDelegator.d.ts b/api/application/abilityDelegator.d.ts index ccd8607a7f..047eb67a40 100644 --- a/api/application/abilityDelegator.d.ts +++ b/api/application/abilityDelegator.d.ts @@ -14,10 +14,11 @@ */ import { AsyncCallback } from '../basic'; -import { Ability } from '../@ohos.application.Ability' -import { AbilityMonitor } from './abilityMonitor' -import { Context } from '../app/context' -import { ShellCmdResult } from './shellCmdResult' +import Ability from '../@ohos.application.Ability'; +import { AbilityMonitor } from './abilityMonitor'; +import { Context } from '../app/context'; +import Want from "../@ohos.application.Want"; +import { ShellCmdResult } from './shellCmdResult'; /** * A global test utility interface used for adding AbilityMonitor objects and control lifecycle states of abilities. @@ -90,6 +91,17 @@ export interface AbilityDelegator { getCurrentTopAbility(callback: AsyncCallback): void; getCurrentTopAbility(): Promise + /** + * Start a new ability. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want Indicates the ability to start + * @return - + */ + startAbility(want: Want, callback: AsyncCallback): void; + startAbility(want: Want): Promise; + /** * Invoke the Ability.onForeground() callback of a specified ability without changing its lifecycle state. * @@ -137,12 +149,11 @@ export interface AbilityDelegator { executeShellCommand(cmd: string, timeoutSecs?: number): Promise; /** - * Prints log information to the unit testing console. + * Finish the test and print log information to the unit testing console. * The total length of the log information to be printed cannot exceed 1000 characters. * * @since 8 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi Hide this for inner system use. * @param msg Log information * @param code Result code */ diff --git a/api/application/shellCmdResult.d.ts b/api/application/shellCmdResult.d.ts index 78e64926ab..8ba156f4ad 100644 --- a/api/application/shellCmdResult.d.ts +++ b/api/application/shellCmdResult.d.ts @@ -28,7 +28,7 @@ export interface ShellCmdResult { * @since 8 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - stdResult: String; + stdResult: string; /** * shell cmd exec result. -- Gitee From 31e09048d3f28b8c84d1eee1cd592bb613988e7d Mon Sep 17 00:00:00 2001 From: njupthan Date: Fri, 8 Apr 2022 15:08:46 +0800 Subject: [PATCH 2/4] [test framework] DTS update Signed-off-by: njupthan --- api/application/abilityMonitor.d.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/api/application/abilityMonitor.d.ts b/api/application/abilityMonitor.d.ts index 81806c4369..6af8397d2a 100644 --- a/api/application/abilityMonitor.d.ts +++ b/api/application/abilityMonitor.d.ts @@ -13,6 +13,8 @@ * limitations under the License. */ +import Ability from '../@ohos.application.Ability'; + /** * Provide methods for matching monitored Ability objects that meet specified conditions. * The most recently matched Ability objects will be saved in the AbilityMonitor object. @@ -37,7 +39,7 @@ export interface AbilityMonitor { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onAbilityCreate?:() => void; + onAbilityCreate?:(data: Ability) => void; /** * Called back when the state of the ability changes to foreground. @@ -45,7 +47,7 @@ export interface AbilityMonitor { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onAbilityForeground?:() => void; + onAbilityForeground?:(data: Ability) => void; /** * Called back when the state of the ability changes to background. @@ -53,7 +55,7 @@ export interface AbilityMonitor { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onAbilityBackground?:() => void; + onAbilityBackground?:(data: Ability) => void; /** * Called back before the ability is destroyed. @@ -61,7 +63,7 @@ export interface AbilityMonitor { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onAbilityDestroy?:() => void; + onAbilityDestroy?:(data: Ability) => void; /** * Called back when an ability window stage is created. @@ -69,7 +71,7 @@ export interface AbilityMonitor { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onWindowStageCreate?:() => void; + onWindowStageCreate?:(data: Ability) => void; /** * Called back when an ability window stage is restored. @@ -77,7 +79,7 @@ export interface AbilityMonitor { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onWindowStageRestore?:() => void; + onWindowStageRestore?:(data: Ability) => void; /** * Called back when an ability window stage is destroyed. @@ -85,7 +87,7 @@ export interface AbilityMonitor { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onWindowStageDestroy?:() => void; + onWindowStageDestroy?:(data: Ability) => void; } export default AbilityMonitor; \ No newline at end of file -- Gitee From 223ed17bedfc18368e8d1e37b3ace39cdb8c7d07 Mon Sep 17 00:00:00 2001 From: njupthan Date: Tue, 19 Apr 2022 20:45:01 +0000 Subject: [PATCH 3/4] Api level modified to 9 Signed-off-by: njupthan --- api/application/abilityDelegator.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/application/abilityDelegator.d.ts b/api/application/abilityDelegator.d.ts index 047eb67a40..5b12e60179 100644 --- a/api/application/abilityDelegator.d.ts +++ b/api/application/abilityDelegator.d.ts @@ -94,7 +94,7 @@ export interface AbilityDelegator { /** * Start a new ability. * - * @since 8 + * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core * @param want Indicates the ability to start * @return - -- Gitee From 48a166486755a91c5c4ef6586637d7f998dd0f1e Mon Sep 17 00:00:00 2001 From: njupthan Date: Wed, 20 Apr 2022 11:26:59 +0000 Subject: [PATCH 4/4] Api level modified to 9 Signed-off-by: njupthan --- api/application/abilityDelegator.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/application/abilityDelegator.d.ts b/api/application/abilityDelegator.d.ts index 5b12e60179..d40f9e07a8 100644 --- a/api/application/abilityDelegator.d.ts +++ b/api/application/abilityDelegator.d.ts @@ -152,7 +152,7 @@ export interface AbilityDelegator { * Finish the test and print log information to the unit testing console. * The total length of the log information to be printed cannot exceed 1000 characters. * - * @since 8 + * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core * @param msg Log information * @param code Result code -- Gitee