提交 9aae33a4 编写于 作者: X xinking129

changesign

Signed-off-by: Nxinking129 <xinxin13@huawei.com>
上级 36d67b8e
...@@ -59,7 +59,7 @@ export default class UIExtAbility extends UIExtensionAbility { ...@@ -59,7 +59,7 @@ export default class UIExtAbility extends UIExtensionAbility {
} }
if (want.action === 'AsyncCallback_0300') { if (want.action === 'AsyncCallback_0300') {
console.info('=======>UIExtAbility onSessionCreate want.action == AsyncCallback_0200======>'); console.info('=======>UIExtAbility onSessionCreate want.action == AsyncCallback_0300======>');
this.context.startAbilityForResult({ this.context.startAbilityForResult({
action: 'AsyncCallback_0300', action: 'AsyncCallback_0300',
bundleName: 'com.example.mainhap', bundleName: 'com.example.mainhap',
......
...@@ -19,12 +19,12 @@ import window from '@ohos.window'; ...@@ -19,12 +19,12 @@ import window from '@ohos.window';
export default class EntryAbility extends UIAbility { export default class EntryAbility extends UIAbility {
onCreate(want, launchParam) { onCreate(want, launchParam) {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
globalThis.terminate = () => { globalThis.terminate = (str) => {
setTimeout(() => { setTimeout(() => {
this.context.terminateSelf().then(() => { this.context.terminateSelf().then(() => {
console.debug("====>terminateSelf end"); console.info("====>terminateSelf " + JSON.stringify(str) + " end");
}).catch((err) => { }).catch((err) => {
console.debug("====>terminateSelf err:" + JSON.stringify(err)); console.info("====>terminateSelf " + JSON.stringify(str) + " err:" + JSON.stringify(err));
}); });
}, 50) }, 50)
}; };
......
...@@ -74,15 +74,12 @@ export default function abilityTest() { ...@@ -74,15 +74,12 @@ export default function abilityTest() {
function unSubscribeCallback() { function unSubscribeCallback() {
console.info(`====>AsyncCallback_0100 unSubscribeCallback 'ACTS_CALL_EVENT'`) console.info(`====>AsyncCallback_0100 unSubscribeCallback 'ACTS_CALL_EVENT'`)
globalThis.terminate() globalThis.terminate('AsyncCallback_0100')
done() done()
} }
}) })
it('ACTS_UIExtensionAbility_StartAbilityForResult_AsyncCallback_0200',0, async function (done) { it('ACTS_UIExtensionAbility_StartAbilityForResult_AsyncCallback_0200',0, async function (done) {
await setTimeout(() => {
console.info(`====>beforeEach setTimeout'`)
}, 2000)
await Driver.create().delayMs(2000) await Driver.create().delayMs(2000)
var subscriber var subscriber
commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => { commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => {
...@@ -122,9 +119,7 @@ export default function abilityTest() { ...@@ -122,9 +119,7 @@ export default function abilityTest() {
}) })
it('ACTS_UIExtensionAbility_StartAbilityForResult_AsyncCallback_0300',0, async function (done) { it('ACTS_UIExtensionAbility_StartAbilityForResult_AsyncCallback_0300',0, async function (done) {
await setTimeout(() => { await Driver.create().delayMs(2000)
console.info(`====>beforeEach setTimeout'`)
}, 2000)
var subscriber var subscriber
commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => { commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => {
console.info(`====>AsyncCallback_0300 createSubscriber ${data}`) console.info(`====>AsyncCallback_0300 createSubscriber ${data}`)
...@@ -164,7 +159,7 @@ export default function abilityTest() { ...@@ -164,7 +159,7 @@ export default function abilityTest() {
function unSubscribeCallback() { function unSubscribeCallback() {
console.info(`====>AsyncCallback_0300 unSubscribeCallback 'ACTS_CALL_EVENT'`) console.info(`====>AsyncCallback_0300 unSubscribeCallback 'ACTS_CALL_EVENT'`)
setTimeout(() => { setTimeout(() => {
globalThis.terminate() globalThis.terminate('AsyncCallback_0300')
abilityDelegator.executeShellCommand('aa force-stop com.example.forresulttestsecond').then((result) =>{ abilityDelegator.executeShellCommand('aa force-stop com.example.forresulttestsecond').then((result) =>{
console.info('====>AsyncCallback_0300 unSubscribeCallback pkill ok' + JSON.stringify(result)); console.info('====>AsyncCallback_0300 unSubscribeCallback pkill ok' + JSON.stringify(result));
done() done()
...@@ -177,9 +172,6 @@ export default function abilityTest() { ...@@ -177,9 +172,6 @@ export default function abilityTest() {
}) })
it('ACTS_UIExtensionAbility_StartAbilityForResult_AsyncCallback_0400',0, async function (done) { it('ACTS_UIExtensionAbility_StartAbilityForResult_AsyncCallback_0400',0, async function (done) {
await setTimeout(() => {
console.info(`====>beforeEach setTimeout'`)
}, 2000)
await Driver.create().delayMs(2000) await Driver.create().delayMs(2000)
var subscriber var subscriber
commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => { commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => {
...@@ -216,16 +208,13 @@ export default function abilityTest() { ...@@ -216,16 +208,13 @@ export default function abilityTest() {
console.info(`====>AsyncCallback_0400 unSubscribeCallback 'ACTS_CALL_EVENT'`) console.info(`====>AsyncCallback_0400 unSubscribeCallback 'ACTS_CALL_EVENT'`)
setTimeout(() => { setTimeout(() => {
globalThis.terminate() globalThis.terminate('AsyncCallback_0400')
done() done()
}, 10000) }, 1000)
} }
}) })
it('ACTS_UIExtensionAbility_StartAbilityForResult_AsyncCallback_0500',0, async function (done) { it('ACTS_UIExtensionAbility_StartAbilityForResult_AsyncCallback_0500',0, async function (done) {
await setTimeout(() => {
console.info(`====>beforeEach setTimeout'`)
}, 2000)
await Driver.create().delayMs(2000) await Driver.create().delayMs(2000)
var subscriber var subscriber
commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => { commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => {
...@@ -245,7 +234,7 @@ export default function abilityTest() { ...@@ -245,7 +234,7 @@ export default function abilityTest() {
console.info(`====>AsyncCallback_0500 subscribeCallBack all ${data.event}`) console.info(`====>AsyncCallback_0500 subscribeCallBack all ${data.event}`)
if(data.event == 'ACTS_CALL_EVENT') { if(data.event == 'ACTS_CALL_EVENT') {
console.info(`====>AsyncCallback_0500 subscribeCallBack 'ACTS_CALL_EVENT' ${data}`) console.info(`====>AsyncCallback_0500 subscribeCallBack 'ACTS_CALL_EVENT' ${data}`)
expect(data.parameters.result != 0).assertTrue(); expect(data.parameters.num).assertEqual(16000001);
commonEvent.unsubscribe(subscriber, unSubscribeCallback) commonEvent.unsubscribe(subscriber, unSubscribeCallback)
} }
} }
...@@ -253,16 +242,13 @@ export default function abilityTest() { ...@@ -253,16 +242,13 @@ export default function abilityTest() {
function unSubscribeCallback() { function unSubscribeCallback() {
console.info(`====>AsyncCallback_0500 unSubscribeCallback 'ACTS_CALL_EVENT'`) console.info(`====>AsyncCallback_0500 unSubscribeCallback 'ACTS_CALL_EVENT'`)
setTimeout(() => { setTimeout(() => {
globalThis.terminate() globalThis.terminate('AsyncCallback_0500')
done() done()
}, 2000) }, 2000)
} }
}) })
it('ACTS_UIExtensionAbility_StartAbilityForResult_AsyncCallback_0600',0, async function (done) { it('ACTS_UIExtensionAbility_StartAbilityForResult_AsyncCallback_0600',0, async function (done) {
await setTimeout(() => {
console.info(`====>beforeEach setTimeout'`)
}, 2000)
await Driver.create().delayMs(2000) await Driver.create().delayMs(2000)
var subscriber var subscriber
commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => { commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => {
...@@ -304,9 +290,7 @@ export default function abilityTest() { ...@@ -304,9 +290,7 @@ export default function abilityTest() {
it('ACTS_UIExtensionAbility_StartAbilityForResult_AsyncCallback_0700',0, async function (done) { it('ACTS_UIExtensionAbility_StartAbilityForResult_AsyncCallback_0700',0, async function (done) {
await setTimeout(() => { await Driver.create().delayMs(2000)
console.info(`====>beforeEach setTimeout'`)
}, 2000)
var subscriber var subscriber
commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => { commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => {
console.info(`====>AsyncCallback_0700 createSubscriber ${data}`) console.info(`====>AsyncCallback_0700 createSubscriber ${data}`)
...@@ -346,9 +330,7 @@ export default function abilityTest() { ...@@ -346,9 +330,7 @@ export default function abilityTest() {
}) })
it('ACTS_UIExtensionAbility_StartAbilityForResult_Promise_0100',0, async function (done) { it('ACTS_UIExtensionAbility_StartAbilityForResult_Promise_0100',0, async function (done) {
await setTimeout(() => { await Driver.create().delayMs(2000)
console.info(`====>beforeEach setTimeout'`)
}, 2000)
var subscriber var subscriber
commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => { commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => {
console.info(`====>Promise_0100 createSubscriber ${data}`) console.info(`====>Promise_0100 createSubscriber ${data}`)
...@@ -374,15 +356,12 @@ export default function abilityTest() { ...@@ -374,15 +356,12 @@ export default function abilityTest() {
function unSubscribeCallback() { function unSubscribeCallback() {
console.info(`====>Promise_0100 unSubscribeCallback 'ACTS_CALL_EVENT'`) console.info(`====>Promise_0100 unSubscribeCallback 'ACTS_CALL_EVENT'`)
globalThis.terminate() globalThis.terminate('Promise_0100')
done() done()
} }
}) })
it('ACTS_UIExtensionAbility_StartAbilityForResult_Promise_0200',0, async function (done) { it('ACTS_UIExtensionAbility_StartAbilityForResult_Promise_0200',0, async function (done) {
await setTimeout(() => {
console.info(`====>beforeEach setTimeout'`)
}, 2000)
var subscriber var subscriber
commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => { commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => {
console.info(`====>Promise_0200 createSubscriber ${data}`) console.info(`====>Promise_0200 createSubscriber ${data}`)
...@@ -416,9 +395,7 @@ export default function abilityTest() { ...@@ -416,9 +395,7 @@ export default function abilityTest() {
}) })
it('ACTS_UIExtensionAbility_StartAbilityForResult_Promise_0300',0, async function (done) { it('ACTS_UIExtensionAbility_StartAbilityForResult_Promise_0300',0, async function (done) {
await setTimeout(() => { await Driver.create().delayMs(2000)
console.info(`====>beforeEach setTimeout'`)
}, 2000)
var subscriber var subscriber
await commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => { await commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => {
console.info(`====>Promise_0300 createSubscriber ${data}`) console.info(`====>Promise_0300 createSubscriber ${data}`)
...@@ -452,7 +429,7 @@ export default function abilityTest() { ...@@ -452,7 +429,7 @@ export default function abilityTest() {
expect(data.parameters.str).assertEqual('ACTION'); expect(data.parameters.str).assertEqual('ACTION');
expect(data.parameters.result).assertEqual(0); expect(data.parameters.result).assertEqual(0);
} }
globalThis.terminate() globalThis.terminate('Promise_0300')
abilityDelegator.executeShellCommand('aa force-stop com.example.forresulttestsecond').then(result =>{ abilityDelegator.executeShellCommand('aa force-stop com.example.forresulttestsecond').then(result =>{
console.info('====>Promise_0300 unSubscribeCallback pkill ok' + JSON.stringify(result)); console.info('====>Promise_0300 unSubscribeCallback pkill ok' + JSON.stringify(result));
commonEvent.unsubscribe(subscriber, unSubscribeCallback) commonEvent.unsubscribe(subscriber, unSubscribeCallback)
...@@ -469,9 +446,7 @@ export default function abilityTest() { ...@@ -469,9 +446,7 @@ export default function abilityTest() {
}) })
it('ACTS_UIExtensionAbility_StartAbilityForResult_Promise_0400',0, async function (done) { it('ACTS_UIExtensionAbility_StartAbilityForResult_Promise_0400',0, async function (done) {
await setTimeout(() => { await Driver.create().delayMs(2000)
console.info(`====>beforeEach setTimeout'`)
}, 2000)
var subscriber var subscriber
commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => { commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => {
console.info(`====>Promise_0400 createSubscriber ${data}`) console.info(`====>Promise_0400 createSubscriber ${data}`)
...@@ -506,16 +481,14 @@ export default function abilityTest() { ...@@ -506,16 +481,14 @@ export default function abilityTest() {
function unSubscribeCallback() { function unSubscribeCallback() {
console.info(`====>Promise_0400 unSubscribeCallback 'ACTS_CALL_EVENT'`) console.info(`====>Promise_0400 unSubscribeCallback 'ACTS_CALL_EVENT'`)
setTimeout(() => { setTimeout(() => {
globalThis.terminate() globalThis.terminate('Promise_0400')
done() done()
}, 1000) }, 1000)
} }
}) })
it('ACTS_UIExtensionAbility_StartAbilityForResult_Promise_0500',0, async function (done) { it('ACTS_UIExtensionAbility_StartAbilityForResult_Promise_0500',0, async function (done) {
await setTimeout(() => { await Driver.create().delayMs(2000)
console.info(`====>beforeEach setTimeout'`)
}, 2000)
var subscriber var subscriber
commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => { commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => {
console.info(`====>Promise_0500 createSubscriber ${data}`) console.info(`====>Promise_0500 createSubscriber ${data}`)
...@@ -534,24 +507,22 @@ export default function abilityTest() { ...@@ -534,24 +507,22 @@ export default function abilityTest() {
console.info(`====>Promise_0500 subscribeCallBack all ${data.event}`) console.info(`====>Promise_0500 subscribeCallBack all ${data.event}`)
if(data.event == 'ACTS_CALL_EVENT') { if(data.event == 'ACTS_CALL_EVENT') {
console.info(`====>Promise_0500 subscribeCallBack 'ACTS_CALL_EVENT' ${data}`) console.info(`====>Promise_0500 subscribeCallBack 'ACTS_CALL_EVENT' ${data}`)
expect(data.parameters.result != 0).assertTrue(); expect(data.parameters.num).assertEqual(16000001);
commonEvent.unsubscribe(subscriber, unSubscribeCallback) commonEvent.unsubscribe(subscriber, unSubscribeCallback)
} }
} }
function unSubscribeCallback() { function unSubscribeCallback() {
console.info(`====>Promise_0500 unSubscribeCallback 'ACTS_CALL_EVENT'`) console.info(`====>Promise_0500 unSubscribeCallback 'ACTS_CALL_EVENT'`)
globalThis.terminate('Promise_0500')
setTimeout(() => { setTimeout(() => {
globalThis.terminate()
done() done()
}, 2000) }, 1000)
} }
}) })
it('ACTS_UIExtensionAbility_StartAbilityForResult_Promise_0600',0, async function (done) { it('ACTS_UIExtensionAbility_StartAbilityForResult_Promise_0600',0, async function (done) {
await setTimeout(() => { await Driver.create().delayMs(2000)
console.info(`====>beforeEach setTimeout'`)
}, 2000)
var subscriber var subscriber
commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => { commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => {
console.info(`====>Promise_0600 createSubscriber ${data}`) console.info(`====>Promise_0600 createSubscriber ${data}`)
...@@ -591,9 +562,7 @@ export default function abilityTest() { ...@@ -591,9 +562,7 @@ export default function abilityTest() {
}) })
it('ACTS_UIExtensionAbility_StartAbilityForResult_Promise_0700',0, async function (done) { it('ACTS_UIExtensionAbility_StartAbilityForResult_Promise_0700',0, async function (done) {
await setTimeout(() => { await Driver.create().delayMs(2000)
console.info(`====>beforeEach setTimeout'`)
}, 2000)
var subscriber var subscriber
commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => { commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => {
console.info(`====>Promise_0700 createSubscriber ${data}`) console.info(`====>Promise_0700 createSubscriber ${data}`)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册