提交 f68d46bd 编写于 作者: H hu0475

修复完善gn格式问题和部分测试用例

Signed-off-by: Nhu0475 <huyanqiang5@huawei.com>
上级 77665827
......@@ -17,8 +17,8 @@ group("ability_crossplatform_runtime") {
testonly = true
if (is_standard_system) {
deps = [
"actscontexttest:context_ets_normal_test",
"actscontexttestentry:context_entry_ets_normal_test"
"actscontexttest:ActsCrossplatformAbilityContextTest",
"actscontexttestentry:ActsCrossplatformAbilityContextEntryTest"
]
}
}
......@@ -6,10 +6,10 @@
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"minAPIVersion": 9,
"targetAPIVersion": 9,
"minAPIVersion": 10,
"targetAPIVersion": 10,
"car": {
"apiCompatibleVersion": 9,
"apiCompatibleVersion": 10,
"singleUser": false
}
}
......
......@@ -13,7 +13,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("context_ets_normal_test") {
ohos_js_hap_suite("ActsCrossplatformAbilityContextTest") {
hap_profile = "src/main/module.json"
deps = [
":windowStage_js_assets",
......@@ -21,7 +21,7 @@ ohos_js_hap_suite("context_ets_normal_test") {
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAbilityContextTest"
hap_name = "ActsCrossplatformAbilityContextTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
......
......@@ -11,8 +11,8 @@
"kits": [
{
"test-file-name": [
"ActsAbilityContextTest.hap",
"ActsAbilityContextEntryTest.hap"
"ActsCrossplatformAbilityContextTest.hap",
"ActsCrossplatformAbilityContextEntryTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
......
......@@ -359,6 +359,46 @@ export default function UIAbilityContext() {
}
})
/**
* @tc.number : ABILITY_TEST_STARTABILITY_PROMISE_0700
* @tc.name : testStartAbilityPromise007
* @tc.desc : test startAbility right want
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('testStartAbilityPromise007', 0, async function (done) {
try {
let context: common.UIAbilityContext = globalThis.abilityContext;
expect(context != null).assertTrue();
var want = {
"bundleName": "com.example.contexttest",
"abilityName": "MainAbility1"
}
context.startAbility(want).then(() => {
console.info('testStartAbilityPromise007 start successful.');
}).catch((error) => {
console.error('testStartAbilityPromise007 start failed. Cause: ' + JSON.stringify(error));
})
await sleep(1500);
const result = globalThis.list1;
console.info('result: ' + JSON.stringify(result));
expect(result[0]).assertEqual('MainAbility1 onCreate');
let context1: common.UIAbilityContext = globalThis.ability1Context;
context1.terminateSelf();
await sleep(1000);
console.log(`testStartAbilityPromise007 success`);
done();
} catch (err) {
console.log(`testStartAbilityPromise007 fail: ` + err);
expect().assertFail();
done();
}
})
/**
* @tc.number : ABILITY_TEST_STARTABILITY_PROMISE_0800
* @tc.name : testStartAbilityPromise008
......@@ -805,6 +845,49 @@ export default function UIAbilityContext() {
}
})
/**
* @tc.number : ABILITY_TEST_STARTABILITY_CALLBACK_0700
* @tc.name : testStartAbilityCallback007
* @tc.desc : test startAbility right want
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('testStartAbilityCallback007', 0, async function (done) {
try {
let context: common.UIAbilityContext = globalThis.abilityContext;
expect(context != null).assertTrue();
var want = {
"bundleName": "com.example.contexttest",
"abilityName": "MainAbility1"
}
context.startAbility(want, (err) => {
if (err.code) {
console.log(`testStartAbilityCallback007 fail: ` + err);
expect().assertFail();
done();
}
console.info('testStartAbilityCallback007 startAbility succeed');
})
await sleep(1500);
const result = globalThis.list1;
console.info('result: ' + JSON.stringify(result));
expect(result[0]).assertEqual('MainAbility1 onCreate');
let context1: common.UIAbilityContext = globalThis.ability1Context;
context1.terminateSelf();
await sleep(1000);
console.log(`testStartAbilityCallback007 success`);
done();
} catch (err) {
console.log(`testStartAbilityCallback007 fail: ` + err);
expect().assertFail();
done();
}
})
/**
* @tc.number : ABILITY_TEST_STARTABILITY_CALLBACK_0800
* @tc.name : testStartAbilityCallback008
......@@ -1060,8 +1143,8 @@ export default function UIAbilityContext() {
/**
* @tc.number : ABILITY_TEST_APPLICATIONINFO_PROMISE_0100
* @tc.name : testApplicationInfoPromise001
* @tc.desc : test filed of applicationInfo
* @tc.name : testTerminateSelfPromise001
* @tc.desc : test terminateSelf(Promise)
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 1
......@@ -1102,13 +1185,13 @@ export default function UIAbilityContext() {
/**
* @tc.number : ABILITY_TEST_APPLICATIONINFO_CALLBACK_0100
* @tc.name : testApplicationInfoCallback001
* @tc.desc : test filed of applicationInfo
* @tc.name : testTerminateSelfCallback001
* @tc.desc : test terminateSelf(Callback)
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 1
*/
it('testApplicationInfoCallback001', 0, async function (done) {
it('testTerminateSelfCallback001', 0, async function (done) {
try {
let context: common.UIAbilityContext = globalThis.abilityContext;
expect(context != null).assertTrue();
......@@ -1119,16 +1202,16 @@ export default function UIAbilityContext() {
"moduleName": "entryTest"
}
context.startAbility(want).then(() => {
console.info('testApplicationInfoCallback001 start successful. ');
console.info('testTerminateSelfCallback001 start successful. ');
}).catch((error) => {
console.error('testApplicationInfoCallback001 start failed. Cause: ' + JSON.stringify(error));
console.error('testTerminateSelfCallback001 start failed. Cause: ' + JSON.stringify(error));
})
await sleep(1500);
let context1: common.UIAbilityContext = globalThis.ability1Context;
context1.terminateSelf((err) => {
if (err.code) {
console.log(`testApplicationInfoCallback001 fail: ` + err);
console.log(`testTerminateSelfCallback001 fail: ` + err);
expect().assertFail();
done();
}
......
......@@ -6,10 +6,10 @@
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"minAPIVersion": 9,
"targetAPIVersion": 9,
"minAPIVersion": 10,
"targetAPIVersion": 10,
"car": {
"apiCompatibleVersion": 9,
"apiCompatibleVersion": 10,
"singleUser": false
}
}
......
......@@ -13,7 +13,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("context_entry_ets_normal_test") {
ohos_hap_assist_suite("ActsCrossplatformAbilityContextEntryTest") {
hap_profile = "src/main/module.json"
deps = [
":windowStage_js_assets",
......@@ -21,7 +21,7 @@ ohos_hap_assist_suite("context_entry_ets_normal_test") {
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAbilityContextEntryTest"
hap_name = "ActsCrossplatformAbilityContextEntryTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册