未验证 提交 b18492ab 编写于 作者: O openharmony_ci 提交者: Gitee

!5927 错误码整改XTS适配---Call调用与Extension相关

Merge pull request !5927 from HuangXW/ErrorCode_Call_Extension
......@@ -47,6 +47,14 @@ var subscriberInfo = {
var caseDepBundles = [];
var subscriber = null;
const ERROR_CODE_INVALID_PARAM = 401;
const ERROR_CODE_CALLER_RELEASED = 16200001;
const ERROR_CODE_CLAAEE_INVALID = 16200002;
const ERROR_CODE_FUNC_REGISTERED = 16200004;
const ERROR_CODE_FUNC_NOT_EXIST = 16200005;
const ERROR_CODE_INNER_ERROR = 16000050;
const ERROR_CODE_TYPE_ERROR = 16000002;
class MySequenceable {
num: number = 0;
str: String = "default";
......@@ -588,19 +596,21 @@ export default function abilityTest() {
*/
it('ACTS_CommonComponent_Call_1700', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_1700 begin');
var caller;
var exceptionFlag = false;
try {
caller = await globalThis.globalThis.abilityContext.startAbilityByCall({
bundleName: systemAppCalleeABundleName,
abilityName: systemAppCalleeAThirdAbilityName,
});
} catch(err) {
console.log('ACTS_CommonComponent_Call_1700 exception' + err);
await globalThis.globalThis.abilityContext.startAbilityByCall({
bundleName: systemAppCalleeABundleName,
abilityName: systemAppCalleeAThirdAbilityName,
}).then(data => {
expect().assertFail();
done();
}).catch(err => {
console.log('ACTS_CommonComponent_Call_1700 call err.code: ' + JSON.stringify(err.code) +
' err.msg: ' + JSON.stringify(err.message));
expect(err.code).assertEqual(ERROR_CODE_TYPE_ERROR);
exceptionFlag = true;
expect(err.message).assertEqual("function request remote error");
}
});
expect(exceptionFlag).assertEqual(true);
done();
})
......@@ -655,8 +665,9 @@ export default function abilityTest() {
try {
globalThis.callee.on('', onTest);
} catch (err) {
console.log('ACTS_CommonComponent_Call_3100 callee.on err' + err);
expect(err.message).assertEqual("function input parameter error");
console.log('ACTS_CommonComponent_Call_3100 call err.code: ' + JSON.stringify(err.code) +
' err.msg: ' + JSON.stringify(err.message));
expect(err.code).assertEqual(ERROR_CODE_INVALID_PARAM);
finishFlag = 1;
}
......@@ -680,8 +691,9 @@ export default function abilityTest() {
try {
globalThis.callee.on(null, onTest);
} catch (err) {
console.log('ACTS_CommonComponent_Call_3200 callee.on err' + err);
expect(err.message).assertEqual("function input parameter error");
console.log('ACTS_CommonComponent_Call_3200 call err.code: ' + JSON.stringify(err.code) +
' err.msg: ' + JSON.stringify(err.message));
expect(err.code).assertEqual(ERROR_CODE_INVALID_PARAM);
finishFlag = 1;
}
......@@ -705,8 +717,9 @@ export default function abilityTest() {
try {
globalThis.callee.on(undefined, onTest);
} catch (err) {
console.log('ACTS_CommonComponent_Call_3300 callee.on err' + err);
expect(err.message).assertEqual("function input parameter error");
console.log('ACTS_CommonComponent_Call_3300 call err.code: ' + JSON.stringify(err.code) +
' err.msg: ' + JSON.stringify(err.message));
expect(err.code).assertEqual(ERROR_CODE_INVALID_PARAM);
finishFlag = 1;
}
......@@ -726,8 +739,9 @@ export default function abilityTest() {
try {
globalThis.callee.off('');
} catch (err) {
console.log('ACTS_CommonComponent_Call_3400 callee.off err' + err);
expect(err.message).assertEqual("function input parameter error");
console.log('ACTS_CommonComponent_Call_3400 call err.code: ' + JSON.stringify(err.code) +
' err.msg: ' + JSON.stringify(err.message));
expect(err.code).assertEqual(ERROR_CODE_INVALID_PARAM);
finishFlag = 1;
}
......@@ -747,8 +761,9 @@ export default function abilityTest() {
try {
globalThis.callee.off(null);
} catch (err) {
console.log('ACTS_CommonComponent_Call_3500 callee.off err' + err);
expect(err.message).assertEqual("function input parameter error");
console.log('ACTS_CommonComponent_Call_3500 call err.code: ' + JSON.stringify(err.code) +
' err.msg: ' + JSON.stringify(err.message));
expect(err.code).assertEqual(ERROR_CODE_INVALID_PARAM);
finishFlag = 1;
}
......@@ -768,8 +783,9 @@ export default function abilityTest() {
try {
globalThis.callee.off(undefined);
} catch (err) {
console.log('ACTS_CommonComponent_Call_3600 callee.off err' + err);
expect(err.message).assertEqual("function input parameter error");
console.log('ACTS_CommonComponent_Call_3600 call err.code: ' + JSON.stringify(err.code) +
' err.msg: ' + JSON.stringify(err.message));
expect(err.code).assertEqual(ERROR_CODE_INVALID_PARAM);
finishFlag = 1;
}
......@@ -788,8 +804,9 @@ export default function abilityTest() {
try {
globalThis.callee.on('testCall', "");
} catch (err) {
console.log('ACTS_CommonComponent_Call_4300 call err' + err);
expect(err.message).assertEqual("function input parameter error");
console.log('ACTS_CommonComponent_Call_4300 call err.code: ' + JSON.stringify(err.code) +
' err.msg: ' + JSON.stringify(err.message));
expect(err.code).assertEqual(ERROR_CODE_INVALID_PARAM);
finishFlag = 1;
}
......@@ -808,8 +825,9 @@ export default function abilityTest() {
try {
globalThis.callee.on('testCall', null);
} catch (err) {
console.log('ACTS_CommonComponent_Call_4400 call err' + err);
expect(err.message).assertEqual("function input parameter error");
console.log('ACTS_CommonComponent_Call_4400 call err.code: ' + JSON.stringify(err.code) +
' err.msg: ' + JSON.stringify(err.message));
expect(err.code).assertEqual(ERROR_CODE_INVALID_PARAM);
finishFlag = 1;
}
......@@ -828,8 +846,9 @@ export default function abilityTest() {
try {
globalThis.callee.on('testCall', undefined);
} catch (err) {
console.log('ACTS_CommonComponent_Call_4500 call err' + err);
expect(err.message).assertEqual("function input parameter error");
console.log('ACTS_CommonComponent_Call_4500 call err.code: ' + JSON.stringify(err.code) +
' err.msg: ' + JSON.stringify(err.message));
expect(err.code).assertEqual(ERROR_CODE_INVALID_PARAM);
finishFlag = 1;
}
......@@ -861,8 +880,9 @@ export default function abilityTest() {
try {
globalThis.callee.on('ACTS_CommonComponent_Call_5000', testCallback_5100);
} catch (err) {
console.log('ACTS_CommonComponent_Call_5000 call err' + err);
expect(err.message).assertEqual("function is registered");
console.log('ACTS_CommonComponent_Call_5000 call err.code: ' + JSON.stringify(err.code) +
' err.msg: ' + JSON.stringify(err.message));
expect(err.code).assertEqual(ERROR_CODE_FUNC_REGISTERED);
finishFlag = 1;
}
......@@ -897,8 +917,9 @@ export default function abilityTest() {
try {
globalThis.callee.off('ACTS_CommonComponent_Call_5100');
} catch (err) {
console.log('ACTS_CommonComponent_Call_5100 call err' + err);
expect(err.message).assertEqual("function not registered");
console.log('ACTS_CommonComponent_Call_5100 call err.code: ' + JSON.stringify(err.code) +
' err.msg: ' + JSON.stringify(err.message));
expect(err.code).assertEqual(ERROR_CODE_FUNC_NOT_EXIST);
finishFlag = 1;
}
......@@ -914,17 +935,19 @@ export default function abilityTest() {
*/
it('ACTS_CommonComponent_Call_5200', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_5200 begin');
let caller;
let exceptionFlag = false;
try {
caller = await globalThis.globalThis.abilityContext.startAbilityByCall(null);
console.log('ACTS_CommonComponent_Call_5200 startAbilityByCall' + JSON.stringify(caller))
} catch(err) {
console.log('ACTS_CommonComponent_Call_5200 exception' + err);
exceptionFlag = true;
expect(err.message).assertEqual("function input parameter error");
}
await globalThis.globalThis.abilityContext.startAbilityByCall(null)
.then(data => {
expect().assertFail();
done();
}).catch(err => {
console.log('ACTS_CommonComponent_Call_5200 call err.code: ' + JSON.stringify(err.code) +
' err.msg: ' + JSON.stringify(err.message));
expect(err.code).assertEqual(ERROR_CODE_INVALID_PARAM);
exceptionFlag = true;
});
expect(exceptionFlag).assertEqual(true);
done();
......@@ -937,20 +960,20 @@ export default function abilityTest() {
*/
it('ACTS_CommonComponent_Call_5300', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_5300 begin');
let caller;
let exceptionFlag = false;
try {
caller = await globalThis.globalThis.abilityContext.startAbilityByCall({
bundleName: "",
abilityName: "",
});
console.log('ACTS_CommonComponent_Call_5300 startAbilityByCall' + JSON.stringify(caller))
} catch(err) {
console.log('ACTS_CommonComponent_Call_5300 exception' + err);
await globalThis.globalThis.abilityContext.startAbilityByCall({
bundleName: "",
abilityName: "",
}).then(data => {
expect().assertFail();
done();
}).catch(err => {
console.log('ACTS_CommonComponent_Call_5300 call err.code: ' + JSON.stringify(err.code) +
' err.msg: ' + JSON.stringify(err.message));
expect(err.code).assertEqual(ERROR_CODE_INNER_ERROR);
exceptionFlag = true;
expect(err.message).assertEqual("function request remote error");
}
});
expect(exceptionFlag).assertEqual(true);
done();
......@@ -963,17 +986,18 @@ export default function abilityTest() {
*/
it('ACTS_CommonComponent_Call_5400', 0, async function (done) {
console.log('ACTS_CommonComponent_Call_5400 begin');
let caller;
let exceptionFlag = false;
try {
caller = await globalThis.globalThis.abilityContext.startAbilityByCall(undefined);
console.log('ACTS_CommonComponent_Call_5400 startAbilityByCall' + JSON.stringify(caller))
} catch(err) {
console.log('ACTS_CommonComponent_Call_5400 exception' + err);
await globalThis.globalThis.abilityContext.startAbilityByCall(undefined)
.then(data => {
expect().assertFail();
done();
}).catch(err => {
console.log('ACTS_CommonComponent_Call_5400 call err.code: ' + JSON.stringify(err.code) +
' err.msg: ' + JSON.stringify(err.message));
expect(err.code).assertEqual(ERROR_CODE_INVALID_PARAM);
exceptionFlag = true;
expect(err.message).assertEqual("function input parameter error");
}
});
expect(exceptionFlag).assertEqual(true);
done();
......
......@@ -24,9 +24,9 @@ import appManager from '@ohos.application.appManager'
import applicationContext from '@ohos.application.context'
import commonEvent from '@ohos.commonEvent';
import ability from '@ohos.ability.ability'
FormDimension
var EXTENSION_INFO_ERR = 2097152
var USERID_ERR = 2097177
var EXTENSION_INFO_ERR = 16000001
var CROSS_USER_DENY = 201
var trueInfo;
var array = new Array();
function sleep(time) {
......@@ -102,7 +102,7 @@ export default function ApiCoverTest() {
expect("case execute failed").assertEqual("data");
}).catch((error) => {
console.error(`Ability: startServiceExtensionAbilityWithAccount failed: ${JSON.stringify(error)}`);
expect(USERID_ERR).assertEqual(error.code);
expect(CROSS_USER_DENY).assertEqual(error.code);
})
done()
})
......@@ -124,7 +124,7 @@ export default function ApiCoverTest() {
expect("case execute failed").assertEqual(data);
}).catch((error) => {
console.error(`Ability: stopServiceExtensionAbilityWithAccount failed: ${JSON.stringify(error)}`);
expect(USERID_ERR).assertEqual(error.code);
expect(CROSS_USER_DENY).assertEqual(error.code);
})
done()
})
......@@ -193,7 +193,7 @@ export default function ApiCoverTest() {
await globalThis.abilityContext.startServiceExtensionAbilityWithAccount(want, 999, (err, data) => {
if (err.code) {
console.error(`Ability: startServiceExtensionAbilityWithAccount failed: ${JSON.stringify(err)}`);
expect(USERID_ERR).assertEqual(err.code);
expect(CROSS_USER_DENY).assertEqual(err.code);
} else {
console.log(`Ability: startServiceExtensionAbilityWithAccount success: ${JSON.stringify(data)}`);
expect("case execute failed").assertEqual(data);
......@@ -217,7 +217,7 @@ export default function ApiCoverTest() {
globalThis.abilityContext.stopServiceExtensionAbilityWithAccount(want, 999, (err, data) => {
if (err.code) {
console.error(`Ability: stopServiceExtensionAbilityWithAccount failed: ${JSON.stringify(err)}`);
expect(USERID_ERR).assertEqual(err.code);
expect(CROSS_USER_DENY).assertEqual(err.code);
} else {
console.log(`Ability: stopServiceExtensionAbilityWithAccount success: ${JSON.stringify(data)}`);
expect("case execute failed").assertEqual(data);
......
......@@ -18,6 +18,7 @@ import AbilityConstant from "@ohos.application.AbilityConstant";
import appManager from "@ohos.application.appManager";
import wantConstant from '@ohos.ability.wantConstant';
var INVALID_PARAM = 401
var TAG
export default function verificationTest(){
......@@ -280,34 +281,34 @@ export default function verificationTest(){
*/
it('SUB_AA_OpenHarmony_SetMissionLabel_0100', 0, async function(done) {
TAG = 'SUB_AA_OpenHarmony_SetMissionLabel_0100 ==>';
let label = undefined;
let code1 = 0;
let code2 = 0;
try {
let label = undefined
let code1 = 0
let code2 = 0
globalThis.abilityContext.setMissionLabel(label).then((data) => {
await globalThis.abilityContext.setMissionLabel(label).then((data) => {
console.info(TAG + "setMissionLabel data = " + JSON.stringify(data));
}).catch((err) => {
code1 = err.code
console.info(TAG + "setMissionLabel err = " + JSON.stringify(err));
});
} catch (err) {
console.info(TAG + "setMissionLabel err = " + JSON.stringify(err));
expect(err.code).assertEqual(INVALID_PARAM);
}
globalThis.abilityContext.setMissionLabel(label, (err, data) => {
try {
await globalThis.abilityContext.setMissionLabel(label, (err, data) => {
code2 = err.code
console.info(TAG + "setMissionLabel err = " + JSON.stringify(err));
console.info(TAG + "setMissionLabel data = " + JSON.stringify(data));
})
setTimeout(()=>{
expect(code1).assertEqual(-1);
expect(code2).assertEqual(-1);
done()
}, 3000)
} catch (err) {
console.info(TAG + "catch err = " + JSON.stringify(err));
expect().assertFail();
done();
console.info(TAG + "setMissionLabel err = " + JSON.stringify(err));
expect(err.code).assertEqual(INVALID_PARAM);
}
done();
})
/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册