提交 a6ae3151 编写于 作者: C caochunlei 提交者: HuangXW
上级 1832dbdb
...@@ -134,21 +134,21 @@ export default function singleusermodelTest() { ...@@ -134,21 +134,21 @@ export default function singleusermodelTest() {
*/ */
it('ACTS_SingleUserModel_1600', 0, async function (done) { it('ACTS_SingleUserModel_1600', 0, async function (done) {
console.debug("====>start startAbilityWithAccount====>"); console.info("====>start startAbilityWithAccount====>");
try { try {
await globalThis.abilityContext.startAbilityWithAccount( await globalThis.abilityContext.startAbilityWithAccount(
{ {
bundleName: 'com.singleusermodel.actssingleusertest', bundleName: 'com.singleusermodel.actssingleusertest',
abilityName: 'SingleUserModel1600' abilityName: 'SingleUserModel1600'
}, null).then((data) => { }, null).then((data) => {
console.debug("====>startAbilityWithAccount 1600 end====>" + data); console.info("====>startAbilityWithAccount 1600 end====>" + data);
}).catch((err) => { }).catch((err) => {
console.debug("====>startAbilityWithAccount 1600 end====>" + err); console.info("====>startAbilityWithAccount 1600 end====>" + err);
}) })
} catch (err) { } catch (err) {
let e = err.toString() let e = err.toString()
let errLog = "Cannot read property then of undefined" let errLog = "Invalid input parameter"
console.debug("====>e====>" + e); console.info("ACTS_SingleUserModel_1600 ====>e====>" + e);
expect(e.indexOf(errLog) >= 0).assertTrue() expect(e.indexOf(errLog) >= 0).assertTrue()
} }
setTimeout(async () => { setTimeout(async () => {
...@@ -176,7 +176,7 @@ export default function singleusermodelTest() { ...@@ -176,7 +176,7 @@ export default function singleusermodelTest() {
console.debug('ACTS_SingleUserModel_1600====>timeout====>'); console.debug('ACTS_SingleUserModel_1600====>timeout====>');
}, START_ABILITY_TIMEOUT) }, START_ABILITY_TIMEOUT)
setTimeout(() => { setTimeout(() => {
console.debug('ACTS_SingleUserModel_1600====>done====>'); console.info('ACTS_SingleUserModel_1600====>done====>');
done(); done();
}, ABILITY_TIMEOUT) }, ABILITY_TIMEOUT)
}) })
...@@ -202,7 +202,7 @@ export default function singleusermodelTest() { ...@@ -202,7 +202,7 @@ export default function singleusermodelTest() {
}) })
} catch (err) { } catch (err) {
let e = err.toString() let e = err.toString()
let errLog = "Cannot read property then of undefined" let errLog = "Invalid input parameter"
console.debug("====>e====>" + e); console.debug("====>e====>" + e);
expect(e.indexOf(errLog) >= 0).assertTrue() expect(e.indexOf(errLog) >= 0).assertTrue()
} }
......
...@@ -182,23 +182,30 @@ export default function singleusermodelTest() { ...@@ -182,23 +182,30 @@ export default function singleusermodelTest() {
*/ */
it('ACTS_ExtensionSingleUserModel_0700', 0, async function (done) { it('ACTS_ExtensionSingleUserModel_0700', 0, async function (done) {
console.log("ACTS_ExtensionSingleUserModel_0700====>callback start====>"); console.log("ACTS_ExtensionSingleUserModel_0700====>callback start====>");
let connId; try {
console.debug("====>start connectAbilityWithAccount====>"); let connId;
connId = globalThis.abilityContext.connectAbilityWithAccount( console.debug("====>start connectAbilityWithAccount====>");
{ connId = globalThis.abilityContext.connectAbilityWithAccount(
bundleName: "com.singleusermodel.actssingleusertest", {
abilityName: "ServiceAbility3", bundleName: "com.singleusermodel.actssingleusertest",
action: "StartAbilityPromise" abilityName: "ServiceAbility3",
}, action: "StartAbilityPromise"
null, },
{ null,
onConnect: onConnectCallbackC, {
onDisconnect: onDisconnectCallbackC, onConnect: onConnectCallbackC,
onFailed: onFailedCallbackC, onDisconnect: onDisconnectCallbackC,
} onFailed: onFailedCallbackC,
); }
console.log('ACTS_ExtensionSingleUserModel_0700====>StartConnectNative ' + );
'connectAbilityWithAccount connId : ' + connId); 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 () => { setTimeout(async () => {
let abilityDelegator = undefined let abilityDelegator = undefined
...@@ -318,23 +325,30 @@ export default function singleusermodelTest() { ...@@ -318,23 +325,30 @@ export default function singleusermodelTest() {
*/ */
it('ACTS_ExtensionSingleUserModel_1300', 0, async function (done) { it('ACTS_ExtensionSingleUserModel_1300', 0, async function (done) {
console.log("ACTS_ExtensionSingleUserModel_1300====>callback start====>"); 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 () => { setTimeout(async () => {
let abilityDelegator = undefined let abilityDelegator = undefined
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
......
...@@ -183,24 +183,31 @@ export default function singleusermodelTest() { ...@@ -183,24 +183,31 @@ export default function singleusermodelTest() {
*/ */
it('ACTS_ExtensionSingleUserModel_1600', 0, async function(done){ it('ACTS_ExtensionSingleUserModel_1600', 0, async function(done){
console.log("ACTS_ExtensionSingleUserModel_1600====>callback start====>"); console.log("ACTS_ExtensionSingleUserModel_1600====>callback start====>");
let connId;
console.debug("====>start connectAbilityWithAccount====>"); try {
connId = globalThis.abilityContext.connectAbilityWithAccount( let connId;
{ console.debug("====>start connectAbilityWithAccount====>");
bundleName: "com.singleusermodel.actssingleusertest", connId = globalThis.abilityContext.connectAbilityWithAccount(
abilityName: "ServiceAbility3", {
action: "StartAbilityPromise" bundleName: "com.singleusermodel.actssingleusertest",
}, abilityName: "ServiceAbility3",
null, action: "StartAbilityPromise"
{ },
onConnect: onConnectCallbackC, null,
onDisconnect: onDisconnectCallbackC, {
onFailed: onFailedCallbackC, onConnect: onConnectCallbackC,
} onDisconnect: onDisconnectCallbackC,
); onFailed: onFailedCallbackC,
console.log('ACTS_ExtensionSingleUserModel_1600====>StartConnectNative ' + }
'connectAbilityWithAccount connId : ' + connId); );
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()=> { setTimeout(async()=> {
let abilityDelegator = undefined let abilityDelegator = undefined
...@@ -323,22 +330,31 @@ export default function singleusermodelTest() { ...@@ -323,22 +330,31 @@ export default function singleusermodelTest() {
*/ */
it('ACTS_ExtensionSingleUserModel_1900', 0, async function(done){ it('ACTS_ExtensionSingleUserModel_1900', 0, async function(done){
console.log("ACTS_ExtensionSingleUserModel_1900====>callback start====>"); console.log("ACTS_ExtensionSingleUserModel_1900====>callback start====>");
let connId;
connId = globalThis.abilityContext.connectAbilityWithAccount( try {
{ let connId;
bundleName: "com.singleusermodel.actssingleusertest", connId = globalThis.abilityContext.connectAbilityWithAccount(
abilityName: "ServiceAbility5", {
action: "StartAbilityPromise" bundleName: "com.singleusermodel.actssingleusertest",
}, abilityName: "ServiceAbility5",
undefined, action: "StartAbilityPromise"
{ },
onConnect: onConnectCallbackE, undefined,
onDisconnect: onDisconnectCallbackE, {
onFailed: onFailedCallbackE, onConnect: onConnectCallbackE,
} onDisconnect: onDisconnectCallbackE,
); onFailed: onFailedCallbackE,
console.log('ACTS_ExtensionSingleUserModel_1900====>StartConnectNative ' + }
'connectAbilityWithAccount connId : ' + connId); );
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()=> { setTimeout(async()=> {
let abilityDelegator = undefined let abilityDelegator = undefined
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
......
...@@ -150,7 +150,7 @@ export default function singleusermodelTest() { ...@@ -150,7 +150,7 @@ export default function singleusermodelTest() {
}) })
} catch (err) { } catch (err) {
let e = err.toString(); let e = err.toString();
let errLog = "Cannot read property then of undefined" let errLog = "Invalid input parameter"
console.debug("====>e====>" + e); console.debug("====>e====>" + e);
expect(e.indexOf(errLog) >= 0).assertTrue() expect(e.indexOf(errLog) >= 0).assertTrue()
} }
...@@ -252,7 +252,7 @@ export default function singleusermodelTest() { ...@@ -252,7 +252,7 @@ export default function singleusermodelTest() {
}) })
} catch (err) { } catch (err) {
let e = err.toString(); let e = err.toString();
let errLog = "Cannot read property then of undefined" let errLog = "Invalid input parameter"
console.debug("====>e====>" + e); console.debug("====>e====>" + e);
expect(e.indexOf(errLog) >= 0).assertTrue() expect(e.indexOf(errLog) >= 0).assertTrue()
} }
......
...@@ -46,9 +46,13 @@ export default class MainAbility extends Ability { ...@@ -46,9 +46,13 @@ export default class MainAbility extends Ability {
onForeground() { onForeground() {
console.log("MainAbility3 onForeground") console.log("MainAbility3 onForeground")
globalThis.abilityContext3.terminateSelfWithResult({
resultCode: 1 try {
}) globalThis.abilityContext3.terminateSelfWithResult({
resultCode: 1
})
} catch (error) {
}
} }
onBackground() { onBackground() {
......
...@@ -24,7 +24,9 @@ import Prompt from '@system.prompt'; ...@@ -24,7 +24,9 @@ import Prompt from '@system.prompt';
import abilityManager from '@ohos.application.abilityManager'; import abilityManager from '@ohos.application.abilityManager';
import commonEvent from '@ohos.commonEvent'; 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) { export default function startAbilityTest(abilityContext) {
describe('startAbilityTest', function () { describe('startAbilityTest', function () {
...@@ -228,7 +230,7 @@ export default function startAbilityTest(abilityContext) { ...@@ -228,7 +230,7 @@ export default function startAbilityTest(abilityContext) {
console.log(TAG + ": startAbility success. data: " + JSON.stringify(data)); console.log(TAG + ": startAbility success. data: " + JSON.stringify(data));
}).catch((error) => { }).catch((error) => {
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(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); await sleep(2000);
console.info("------------end FreeInstall_Stage_Local_StartAbility_0300-------------"); console.info("------------end FreeInstall_Stage_Local_StartAbility_0300-------------");
...@@ -504,7 +506,7 @@ export default function startAbilityTest(abilityContext) { ...@@ -504,7 +506,7 @@ export default function startAbilityTest(abilityContext) {
console.log(TAG + ": startAbility success. data: " + JSON.stringify(data)); console.log(TAG + ": startAbility success. data: " + JSON.stringify(data));
}).catch((error) => { }).catch((error) => {
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(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); await sleep(2000);
console.info("------------end FreeInstall_Stage_Local_StartAbility_1100-------------"); console.info("------------end FreeInstall_Stage_Local_StartAbility_1100-------------");
...@@ -568,7 +570,7 @@ export default function startAbilityTest(abilityContext) { ...@@ -568,7 +570,7 @@ export default function startAbilityTest(abilityContext) {
console.log(TAG + ": startAbility success. data: " + JSON.stringify(data)); console.log(TAG + ": startAbility success. data: " + JSON.stringify(data));
}).catch((error) => { }).catch((error) => {
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(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); await sleep(2000);
console.info("------------end FreeInstall_Stage_Local_StartAbility_1300-------------"); console.info("------------end FreeInstall_Stage_Local_StartAbility_1300-------------");
...@@ -632,7 +634,7 @@ export default function startAbilityTest(abilityContext) { ...@@ -632,7 +634,7 @@ export default function startAbilityTest(abilityContext) {
console.log(TAG + ": startAbility success. data: " + JSON.stringify(data)); console.log(TAG + ": startAbility success. data: " + JSON.stringify(data));
}).catch((error) => { }).catch((error) => {
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(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); await sleep(2000);
console.info("------------end FreeInstall_Stage_Local_StartAbility_1500-------------"); console.info("------------end FreeInstall_Stage_Local_StartAbility_1500-------------");
...@@ -694,7 +696,7 @@ export default function startAbilityTest(abilityContext) { ...@@ -694,7 +696,7 @@ export default function startAbilityTest(abilityContext) {
console.log(TAG + ": startAbility success. data: " + JSON.stringify(data)); console.log(TAG + ": startAbility success. data: " + JSON.stringify(data));
}).catch((error) => { }).catch((error) => {
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(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); await sleep(2000);
console.info("------------end FreeInstall_Stage_Local_StartAbility_1700-------------"); console.info("------------end FreeInstall_Stage_Local_StartAbility_1700-------------");
...@@ -831,7 +833,7 @@ export default function startAbilityTest(abilityContext) { ...@@ -831,7 +833,7 @@ export default function startAbilityTest(abilityContext) {
console.log(TAG + ": startAbility success. data: " + JSON.stringify(data)); console.log(TAG + ": startAbility success. data: " + JSON.stringify(data));
}).catch((error) => { }).catch((error) => {
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(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); await sleep(2000);
console.info("------------end FreeInstall_Stage_Local_StartAbility_2300-------------"); console.info("------------end FreeInstall_Stage_Local_StartAbility_2300-------------");
...@@ -866,7 +868,7 @@ export default function startAbilityTest(abilityContext) { ...@@ -866,7 +868,7 @@ export default function startAbilityTest(abilityContext) {
console.log(TAG + ": startAbility success. data: " + JSON.stringify(data)); console.log(TAG + ": startAbility success. data: " + JSON.stringify(data));
}).catch((error) => { }).catch((error) => {
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(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); await sleep(2000);
console.info("------------end FreeInstall_Stage_Local_StartAbility_2400-------------"); console.info("------------end FreeInstall_Stage_Local_StartAbility_2400-------------");
...@@ -914,7 +916,7 @@ export default function startAbilityTest(abilityContext) { ...@@ -914,7 +916,7 @@ export default function startAbilityTest(abilityContext) {
console.log(TAG + ": startAbility success. data: " + JSON.stringify(data)); console.log(TAG + ": startAbility success. data: " + JSON.stringify(data));
}).catch((error) => { }).catch((error) => {
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(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); await sleep(2000);
console.info("------------end FreeInstall_Stage_Local_StartAbility_2500-------------"); console.info("------------end FreeInstall_Stage_Local_StartAbility_2500-------------");
...@@ -1010,7 +1012,7 @@ export default function startAbilityTest(abilityContext) { ...@@ -1010,7 +1012,7 @@ export default function startAbilityTest(abilityContext) {
console.log(TAG + ": startAbility success. data: " + JSON.stringify(data)); console.log(TAG + ": startAbility success. data: " + JSON.stringify(data));
}).catch((error) => { }).catch((error) => {
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(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); await sleep(2000);
console.info("------------end FreeInstall_Stage_Local_StartAbility_3100-------------"); console.info("------------end FreeInstall_Stage_Local_StartAbility_3100-------------");
...@@ -1049,7 +1051,7 @@ export default function startAbilityTest(abilityContext) { ...@@ -1049,7 +1051,7 @@ export default function startAbilityTest(abilityContext) {
console.log(TAG + ": startAbility success. data: " + JSON.stringify(data)); console.log(TAG + ": startAbility success. data: " + JSON.stringify(data));
}).catch((error) => { }).catch((error) => {
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(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); await sleep(2000);
console.info("------------end FreeInstall_Stage_Local_StartAbility_3200-------------"); console.info("------------end FreeInstall_Stage_Local_StartAbility_3200-------------");
...@@ -1077,7 +1079,7 @@ export default function startAbilityTest(abilityContext) { ...@@ -1077,7 +1079,7 @@ export default function startAbilityTest(abilityContext) {
console.log(TAG + ": startAbility success. data: " + JSON.stringify(data)); console.log(TAG + ": startAbility success. data: " + JSON.stringify(data));
}).catch((error) => { }).catch((error) => {
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(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); await sleep(2000);
console.info("------------end FreeInstall_Stage_Local_StartAbility_3300-------------"); console.info("------------end FreeInstall_Stage_Local_StartAbility_3300-------------");
...@@ -1181,7 +1183,7 @@ export default function startAbilityTest(abilityContext) { ...@@ -1181,7 +1183,7 @@ export default function startAbilityTest(abilityContext) {
console.log(TAG + ": startAbility success. data: " + JSON.stringify(data)); console.log(TAG + ": startAbility success. data: " + JSON.stringify(data));
}).catch((error) => { }).catch((error) => {
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(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); await sleep(2000);
console.info("------------end FreeInstall_Stage_Local_StartAbility_1900-------------"); console.info("------------end FreeInstall_Stage_Local_StartAbility_1900-------------");
...@@ -1228,7 +1230,7 @@ export default function startAbilityTest(abilityContext) { ...@@ -1228,7 +1230,7 @@ export default function startAbilityTest(abilityContext) {
console.log(TAG + ": startAbility success. data: " + JSON.stringify(data)); console.log(TAG + ": startAbility success. data: " + JSON.stringify(data));
}).catch((error) => { }).catch((error) => {
console.log(TAG + ": startAbility fail. err: " + JSON.stringify(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); await sleep(2000);
console.info("------------end FreeInstall_Stage_Local_StartAbility_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.
先完成此消息的编辑!
想要评论请 注册