提交 6eb000fc 编写于 作者: Z zhoujun62

solve ActsNewWantTest#ACTS_NewWant_Test_0800 probabilistic failure problem

Signed-off-by: Nzhoujun62 <zhoujun62@huawei.com>
上级 f508c78a
......@@ -134,35 +134,26 @@ export default function verificationTest(){
try {
let list1 = []
let list2 = ["Fa_Auxiliary_MainAbility4_onDestroy", "Fa_Auxiliary_MainAbility5_onDestroy"]
let list2 = ["Fa_Auxiliary_MainAbility4_onDestroy"]
let number1 = undefined
let number2 = undefined
let number3 = undefined
let code1 = 536870912
let code2 = 2048
let subscriber = null
let subscribeInfo = {
events: ["Fa_Auxiliary_MainAbility4_onCreate", "Fa_Auxiliary_MainAbility4_onDestroy",
"Fa_Auxiliary_MainAbility5_onCreate", "Fa_Auxiliary_MainAbility5_onDestroy"]
events: ["Fa_Auxiliary_MainAbility4_onCreate", "Fa_Auxiliary_MainAbility4_onDestroy"]
}
function SubscribeInfoCallback(err, data) {
console.info(TAG + "===SubscribeInfoCallback===" + JSON.stringify(data))
if (data.event == "Fa_Auxiliary_MainAbility4_onCreate") {
number1 = data.parameters.flags
}
if (data.event == "Fa_Auxiliary_MainAbility5_onCreate") {
number2 = data.parameters.flags
}
if (data.event == "Fa_Auxiliary_MainAbility4_onDestroy") {
list1[0] = "Fa_Auxiliary_MainAbility4_onDestroy"
}
if (data.event == "Fa_Auxiliary_MainAbility5_onDestroy") {
list1[1] = "Fa_Auxiliary_MainAbility5_onDestroy"
}
if (JSON.stringify(list1) == JSON.stringify(list2)) {
expect(number3).assertEqual(1);
expect(number1).assertEqual(code1);
expect(number2).assertEqual(code2);
commonEvent.unsubscribe(subscriber, UnSubscribeInfoCallback)
}
}
......@@ -204,21 +195,6 @@ export default function verificationTest(){
expect().assertFail();
done();
});
let wantNum3 = {
want: {
bundleName: 'ohos.acts.aafwk.test.faauxiliary',
abilityName: 'ohos.acts.aafwk.test.faauxiliary.MainAbility5',
flags: wantConstant.Flags.FLAG_INSTALL_ON_DEMAND
}
}
await ability_featureAbility.startAbility(wantNum3).then((data) => {
console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => {
console.info(TAG + "startAbility err = " + JSON.stringify(err));
expect().assertFail();
done();
});
} catch (err) {
console.info(TAG + "catch err = " + JSON.stringify(err));
expect().assertFail();
......
......@@ -17,6 +17,15 @@ import ServiceExtension from '@ohos.application.ServiceExtensionAbility';
import Want from '@ohos.application.Want';
import rpc from "@ohos.rpc";
function sleep(delay) {
let start = new Date().getTime();
while (true) {
if (new Date().getTime() - start > delay) {
break;
}
}
}
export default class ServiceAbility extends ServiceExtension {
onCreate(want: Want) {
globalThis.abilityWant = want;
......@@ -28,6 +37,7 @@ export default class ServiceAbility extends ServiceExtension {
}
onConnect(want) {
sleep(1000)
var connId;
console.log('ACTS_NewWant ServiceAbility onConnect, want:' + want.abilityName);
globalThis.extensionContext = this.context
......
......@@ -593,10 +593,8 @@ export default function abilityTest() {
console.debug("ACTS_NewWant_Test_0800====>flagOnNewWant:====>"
+ flagOnNewWant)
if ((flagOnCreate == 0 && flagOnWindowStageCreate == 0
&& flagOnForeground == 2 && flagOnNewWant == 1)
|| (flagOnCreate == 1 && flagOnWindowStageCreate == 1
&& flagOnForeground == 2 && flagOnNewWant == 0)) {
if (flagOnCreate == 0 && flagOnWindowStageCreate == 0
&& flagOnForeground == 2 && flagOnNewWant == 1) {
flagNewWant = true;
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册