From 1651312fc83826c7fa25f3b2230197a1b3af4755 Mon Sep 17 00:00:00 2001 From: zhoujun62 Date: Wed, 28 Sep 2022 22:35:43 +0800 Subject: [PATCH] Solve Xts ActsServiceAbilityClientTest fail Signed-off-by: zhoujun62 --- .../entry/src/main/ets/ServiceAbility/service.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserverrelyhap/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserverrelyhap/entry/src/main/ets/ServiceAbility/service.ts index c9c458edc..1ce8cbf69 100644 --- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserverrelyhap/entry/src/main/ets/ServiceAbility/service.ts +++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserverrelyhap/entry/src/main/ets/ServiceAbility/service.ts @@ -48,6 +48,16 @@ class StubTest extends rpc.RemoteObject { console.log('ACTS_SerivceAbilityServer ====< method called.') } } + +function sleep(delay) { + let start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } +} + export default { onStart(want) { console.debug('ACTS_SerivceAbilityServer 0425 ====>onStart .ts 0851 =' @@ -78,6 +88,7 @@ export default { }, } ); + sleep(600) particleAbility.terminateSelf().then((data) => { console.log('ACTS_SerivceAbilityServer terminateSelf data:' + JSON.stringify(data)); }).catch((error) => { @@ -201,4 +212,4 @@ export default { ); commonEvent.publish("ACTS_SerivceAbilityServer_OnAbilityConnectDone", (err) => { }); }, -}; \ No newline at end of file +}; -- GitLab