提交 8f27c5fe 编写于 作者: C caochunlei

caochunlei1@huawei.com

Signed-off-by: Ncaochunlei <caochunlei1@huawei.com>
上级 482b4870
......@@ -134,21 +134,21 @@ export default function singleusermodelTest() {
*/
it('ACTS_SingleUserModel_1600', 0, async function (done) {
console.debug("====>start startAbilityWithAccount====>");
console.info("====>start startAbilityWithAccount====>");
try {
await globalThis.abilityContext.startAbilityWithAccount(
{
bundleName: 'com.singleusermodel.actssingleusertest',
abilityName: 'SingleUserModel1600'
}, null).then((data) => {
console.debug("====>startAbilityWithAccount 1600 end====>" + data);
console.info("====>startAbilityWithAccount 1600 end====>" + data);
}).catch((err) => {
console.debug("====>startAbilityWithAccount 1600 end====>" + err);
console.info("====>startAbilityWithAccount 1600 end====>" + err);
})
} catch (err) {
let e = err.toString()
let errLog = "Cannot read property then of undefined"
console.debug("====>e====>" + e);
let errLog = "Invalid input parameter"
console.info("ACTS_SingleUserModel_1600 ====>e====>" + e);
expect(e.indexOf(errLog) >= 0).assertTrue()
}
setTimeout(async () => {
......@@ -176,7 +176,7 @@ export default function singleusermodelTest() {
console.debug('ACTS_SingleUserModel_1600====>timeout====>');
}, START_ABILITY_TIMEOUT)
setTimeout(() => {
console.debug('ACTS_SingleUserModel_1600====>done====>');
console.info('ACTS_SingleUserModel_1600====>done====>');
done();
}, ABILITY_TIMEOUT)
})
......@@ -202,7 +202,7 @@ export default function singleusermodelTest() {
})
} catch (err) {
let e = err.toString()
let errLog = "Cannot read property then of undefined"
let errLog = "Invalid input parameter"
console.debug("====>e====>" + e);
expect(e.indexOf(errLog) >= 0).assertTrue()
}
......
......@@ -182,23 +182,30 @@ export default function singleusermodelTest() {
*/
it('ACTS_ExtensionSingleUserModel_0700', 0, async function (done) {
console.log("ACTS_ExtensionSingleUserModel_0700====>callback start====>");
let connId;
console.debug("====>start connectAbilityWithAccount====>");
connId = globalThis.abilityContext.connectAbilityWithAccount(
{
bundleName: "com.singleusermodel.actssingleusertest",
abilityName: "ServiceAbility3",
action: "StartAbilityPromise"
},
null,
{
onConnect: onConnectCallbackC,
onDisconnect: onDisconnectCallbackC,
onFailed: onFailedCallbackC,
}
);
console.log('ACTS_ExtensionSingleUserModel_0700====>StartConnectNative ' +
'connectAbilityWithAccount connId : ' + connId);
try {
let connId;
console.debug("====>start connectAbilityWithAccount====>");
connId = globalThis.abilityContext.connectAbilityWithAccount(
{
bundleName: "com.singleusermodel.actssingleusertest",
abilityName: "ServiceAbility3",
action: "StartAbilityPromise"
},
null,
{
onConnect: onConnectCallbackC,
onDisconnect: onDisconnectCallbackC,
onFailed: onFailedCallbackC,
}
);
console.log('ACTS_ExtensionSingleUserModel_0700====>StartConnectNative ' +
'connectAbilityWithAccount connId : ' + connId);
} catch (err) {
let e = err.toString()
let errLog = "Invalid input parameter"
console.debug("====>e====>" + e);
expect(e.indexOf(errLog) >= 0).assertTrue()
}
setTimeout(async () => {
let abilityDelegator = undefined
......@@ -318,23 +325,30 @@ export default function singleusermodelTest() {
*/
it('ACTS_ExtensionSingleUserModel_1300', 0, async function (done) {
console.log("ACTS_ExtensionSingleUserModel_1300====>callback start====>");
let connId;
try {
let connId;
connId = globalThis.abilityContext.connectAbilityWithAccount(
{
bundleName: "com.singleusermodel.actssingleusertest",
abilityName: "ServiceAbility5",
action: "StartAbilityPromise"
},
undefined,
{
onConnect: onConnectCallbackE,
onDisconnect: onDisconnectCallbackE,
onFailed: onFailedCallbackE,
}
);
console.log('ACTS_ExtensionSingleUserModel_1300====>StartConnectNative ' +
'connectAbilityWithAccount connId : ' + connId);
} catch (err) {
let e = err.toString()
let errLog = "Invalid input parameter"
console.debug("====>e====>" + e);
expect(e.indexOf(errLog) >= 0).assertTrue()
}
connId = globalThis.abilityContext.connectAbilityWithAccount(
{
bundleName: "com.singleusermodel.actssingleusertest",
abilityName: "ServiceAbility5",
action: "StartAbilityPromise"
},
undefined,
{
onConnect: onConnectCallbackE,
onDisconnect: onDisconnectCallbackE,
onFailed: onFailedCallbackE,
}
);
console.log('ACTS_ExtensionSingleUserModel_1300====>StartConnectNative ' +
'connectAbilityWithAccount connId : ' + connId);
setTimeout(async () => {
let abilityDelegator = undefined
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
......
......@@ -183,24 +183,31 @@ export default function singleusermodelTest() {
*/
it('ACTS_ExtensionSingleUserModel_1600', 0, async function(done){
console.log("ACTS_ExtensionSingleUserModel_1600====>callback start====>");
let connId;
console.debug("====>start connectAbilityWithAccount====>");
connId = globalThis.abilityContext.connectAbilityWithAccount(
{
bundleName: "com.singleusermodel.actssingleusertest",
abilityName: "ServiceAbility3",
action: "StartAbilityPromise"
},
null,
{
onConnect: onConnectCallbackC,
onDisconnect: onDisconnectCallbackC,
onFailed: onFailedCallbackC,
}
);
console.log('ACTS_ExtensionSingleUserModel_1600====>StartConnectNative ' +
'connectAbilityWithAccount connId : ' + connId);
try {
let connId;
console.debug("====>start connectAbilityWithAccount====>");
connId = globalThis.abilityContext.connectAbilityWithAccount(
{
bundleName: "com.singleusermodel.actssingleusertest",
abilityName: "ServiceAbility3",
action: "StartAbilityPromise"
},
null,
{
onConnect: onConnectCallbackC,
onDisconnect: onDisconnectCallbackC,
onFailed: onFailedCallbackC,
}
);
console.log('ACTS_ExtensionSingleUserModel_1600====>StartConnectNative ' +
'connectAbilityWithAccount connId : ' + connId);
} catch (err) {
let e = err.toString()
let errLog = "Invalid input parameter"
console.debug("====>e====>" + e);
expect(e.indexOf(errLog) >= 0).assertTrue()
}
setTimeout(async()=> {
let abilityDelegator = undefined
......@@ -323,22 +330,31 @@ export default function singleusermodelTest() {
*/
it('ACTS_ExtensionSingleUserModel_1900', 0, async function(done){
console.log("ACTS_ExtensionSingleUserModel_1900====>callback start====>");
let connId;
connId = globalThis.abilityContext.connectAbilityWithAccount(
{
bundleName: "com.singleusermodel.actssingleusertest",
abilityName: "ServiceAbility5",
action: "StartAbilityPromise"
},
undefined,
{
onConnect: onConnectCallbackE,
onDisconnect: onDisconnectCallbackE,
onFailed: onFailedCallbackE,
}
);
console.log('ACTS_ExtensionSingleUserModel_1900====>StartConnectNative ' +
'connectAbilityWithAccount connId : ' + connId);
try {
let connId;
connId = globalThis.abilityContext.connectAbilityWithAccount(
{
bundleName: "com.singleusermodel.actssingleusertest",
abilityName: "ServiceAbility5",
action: "StartAbilityPromise"
},
undefined,
{
onConnect: onConnectCallbackE,
onDisconnect: onDisconnectCallbackE,
onFailed: onFailedCallbackE,
}
);
console.log('ACTS_ExtensionSingleUserModel_1900====>StartConnectNative ' +
'connectAbilityWithAccount connId : ' + connId);
} catch (err) {
let e = err.toString()
let errLog = "Invalid input parameter"
console.debug("====>e====>" + e);
expect(e.indexOf(errLog) >= 0).assertTrue()
}
setTimeout(async()=> {
let abilityDelegator = undefined
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
......
......@@ -150,7 +150,7 @@ export default function singleusermodelTest() {
})
} catch (err) {
let e = err.toString();
let errLog = "Cannot read property then of undefined"
let errLog = "Invalid input parameter"
console.debug("====>e====>" + e);
expect(e.indexOf(errLog) >= 0).assertTrue()
}
......@@ -252,7 +252,7 @@ export default function singleusermodelTest() {
})
} catch (err) {
let e = err.toString();
let errLog = "Cannot read property then of undefined"
let errLog = "Invalid input parameter"
console.debug("====>e====>" + e);
expect(e.indexOf(errLog) >= 0).assertTrue()
}
......
......@@ -46,9 +46,13 @@ export default class MainAbility extends Ability {
onForeground() {
console.log("MainAbility3 onForeground")
globalThis.abilityContext3.terminateSelfWithResult({
resultCode: 1
})
try {
globalThis.abilityContext3.terminateSelfWithResult({
resultCode: 1
})
} catch (error) {
}
}
onBackground() {
......
......@@ -24,7 +24,9 @@ import Prompt from '@system.prompt';
import abilityManager from '@ohos.application.abilityManager';
import commonEvent from '@ohos.commonEvent';
const SYSTEM_INNER_ERROR = 16000050
const ERR_COMPONENT_NOF_FOUND = 16000001
const ERR_NOT_TOP = 16000053
export default function startAbilityTest(abilityContext) {
describe('startAbilityTest', function () {
......@@ -228,7 +230,7 @@ export default function startAbilityTest(abilityContext) {
console.log(TAG + ": startAbility success. data: " + JSON.stringify(data));
}).catch((error) => {
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(error));
expect(error.code == 4).assertTrue();
expect(error.code == SYSTEM_INNER_ERROR).assertTrue();
});
await sleep(2000);
console.info("------------end FreeInstall_Stage_Local_StartAbility_0300-------------");
......@@ -504,7 +506,7 @@ export default function startAbilityTest(abilityContext) {
console.log(TAG + ": startAbility success. data: " + JSON.stringify(data));
}).catch((error) => {
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(error));
expect(error.code == 1).assertTrue();
expect(error.code == ERR_COMPONENT_NOF_FOUND).assertTrue();
});
await sleep(2000);
console.info("------------end FreeInstall_Stage_Local_StartAbility_1100-------------");
......@@ -568,7 +570,7 @@ export default function startAbilityTest(abilityContext) {
console.log(TAG + ": startAbility success. data: " + JSON.stringify(data));
}).catch((error) => {
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(error));
expect(error.code == 1).assertTrue();
expect(error.code == ERR_COMPONENT_NOF_FOUND).assertTrue();
});
await sleep(2000);
console.info("------------end FreeInstall_Stage_Local_StartAbility_1300-------------");
......@@ -632,7 +634,7 @@ export default function startAbilityTest(abilityContext) {
console.log(TAG + ": startAbility success. data: " + JSON.stringify(data));
}).catch((error) => {
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(error));
expect(error.code == 1).assertTrue();
expect(error.code == ERR_COMPONENT_NOF_FOUND).assertTrue();
});
await sleep(2000);
console.info("------------end FreeInstall_Stage_Local_StartAbility_1500-------------");
......@@ -694,7 +696,7 @@ export default function startAbilityTest(abilityContext) {
console.log(TAG + ": startAbility success. data: " + JSON.stringify(data));
}).catch((error) => {
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(error));
expect(error.code == 1).assertTrue();
expect(error.code == ERR_COMPONENT_NOF_FOUND).assertTrue();
});
await sleep(2000);
console.info("------------end FreeInstall_Stage_Local_StartAbility_1700-------------");
......@@ -831,7 +833,7 @@ export default function startAbilityTest(abilityContext) {
console.log(TAG + ": startAbility success. data: " + JSON.stringify(data));
}).catch((error) => {
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(error));
expect(error.code == 13).assertTrue();
expect(error.code == ERR_NOT_TOP).assertTrue();
});
await sleep(2000);
console.info("------------end FreeInstall_Stage_Local_StartAbility_2300-------------");
......@@ -866,7 +868,7 @@ export default function startAbilityTest(abilityContext) {
console.log(TAG + ": startAbility success. data: " + JSON.stringify(data));
}).catch((error) => {
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(error));
expect(error.code == 13).assertTrue();
expect(error.code == ERR_NOT_TOP).assertTrue();
});
await sleep(2000);
console.info("------------end FreeInstall_Stage_Local_StartAbility_2400-------------");
......@@ -914,7 +916,7 @@ export default function startAbilityTest(abilityContext) {
console.log(TAG + ": startAbility success. data: " + JSON.stringify(data));
}).catch((error) => {
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(error));
expect(error.code == 3).assertTrue();
expect(error.code == SYSTEM_INNER_ERROR).assertTrue();
});
await sleep(2000);
console.info("------------end FreeInstall_Stage_Local_StartAbility_2500-------------");
......@@ -1010,7 +1012,7 @@ export default function startAbilityTest(abilityContext) {
console.log(TAG + ": startAbility success. data: " + JSON.stringify(data));
}).catch((error) => {
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(error));
expect(error.code == 4).assertTrue();
expect(error.code == SYSTEM_INNER_ERROR).assertTrue();
});
await sleep(2000);
console.info("------------end FreeInstall_Stage_Local_StartAbility_3100-------------");
......@@ -1049,7 +1051,7 @@ export default function startAbilityTest(abilityContext) {
console.log(TAG + ": startAbility success. data: " + JSON.stringify(data));
}).catch((error) => {
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(error));
expect(error.code == 1).assertTrue();
expect(error.code == SYSTEM_INNER_ERROR).assertTrue();
});
await sleep(2000);
console.info("------------end FreeInstall_Stage_Local_StartAbility_3200-------------");
......@@ -1077,7 +1079,7 @@ export default function startAbilityTest(abilityContext) {
console.log(TAG + ": startAbility success. data: " + JSON.stringify(data));
}).catch((error) => {
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(error));
expect(error.code == 1).assertTrue();
expect(error.code == SYSTEM_INNER_ERROR).assertTrue();
});
await sleep(2000);
console.info("------------end FreeInstall_Stage_Local_StartAbility_3300-------------");
......@@ -1181,7 +1183,7 @@ export default function startAbilityTest(abilityContext) {
console.log(TAG + ": startAbility success. data: " + JSON.stringify(data));
}).catch((error) => {
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(error));
expect(error.code == 13).assertTrue();
expect(error.code == ERR_NOT_TOP).assertTrue();
});
await sleep(2000);
console.info("------------end FreeInstall_Stage_Local_StartAbility_1900-------------");
......@@ -1228,7 +1230,7 @@ export default function startAbilityTest(abilityContext) {
console.log(TAG + ": startAbility success. data: " + JSON.stringify(data));
}).catch((error) => {
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(error));
expect(error.code == 13).assertTrue();
expect(error.code == ERR_NOT_TOP).assertTrue();
});
await sleep(2000);
console.info("------------end FreeInstall_Stage_Local_StartAbility_2000-------------");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册