提交 bb5e1f3e 编写于 作者: H hu0475

测试abilityconstant和更改gn格式

Signed-off-by: Nhu0475 <huyanqiang5@huawei.com>
上级 ea69e945
...@@ -18,8 +18,8 @@ group("ability") { ...@@ -18,8 +18,8 @@ group("ability") {
if (is_standard_system) { if (is_standard_system) {
deps = [ deps = [
"ability_runtime:ability_runtime", "ability_runtime:ability_runtime",
"crossplatform:ability_crossplatform",
"dmsfwk:dmsfwk", "dmsfwk:dmsfwk",
"crossplatform:ability_crossplatform"
] ]
} }
} }
...@@ -16,8 +16,6 @@ import("//build/ohos_var.gni") ...@@ -16,8 +16,6 @@ import("//build/ohos_var.gni")
group("ability_crossplatform") { group("ability_crossplatform") {
testonly = true testonly = true
if (is_standard_system) { if (is_standard_system) {
deps = [ deps = [ "ability_runtime:ability_crossplatform_runtime" ]
"ability_runtime:ability_crossplatform_runtime",
]
} }
} }
...@@ -21,6 +21,7 @@ ohos_hap_assist_suite("ActsLifeCycleEtsFeatureTest") { ...@@ -21,6 +21,7 @@ ohos_hap_assist_suite("ActsLifeCycleEtsFeatureTest") {
] ]
ets2abc = true ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "./signature/openharmony_sx.p7b"
# hap_name: HAP的名字,可选,默认为目标名 # hap_name: HAP的名字,可选,默认为目标名
hap_name = "ActsLifeCycleEtsFeatureTest" hap_name = "ActsLifeCycleEtsFeatureTest"
subsystem_name = "ability" subsystem_name = "ability"
...@@ -29,6 +30,7 @@ ohos_hap_assist_suite("ActsLifeCycleEtsFeatureTest") { ...@@ -29,6 +30,7 @@ ohos_hap_assist_suite("ActsLifeCycleEtsFeatureTest") {
ohos_app_scope("windowStage_app_profile") { ohos_app_scope("windowStage_app_profile") {
# app_profile: HAP的AppScope中的app.json,只在Stage模型下使用 # app_profile: HAP的AppScope中的app.json,只在Stage模型下使用
app_profile = "AppScope/app.json" app_profile = "AppScope/app.json"
# sources: 资源文件路径 # sources: 资源文件路径
sources = [ "AppScope/resources" ] sources = [ "AppScope/resources" ]
} }
...@@ -39,8 +41,10 @@ ohos_js_assets("windowStage_js_assets") { ...@@ -39,8 +41,10 @@ ohos_js_assets("windowStage_js_assets") {
ohos_resources("windowStage_resources") { ohos_resources("windowStage_resources") {
# sources: 资源文件路径 # sources: 资源文件路径
sources = [ "src/main/resources" ] sources = [ "src/main/resources" ]
# deps: 当前目标的依赖 # deps: 当前目标的依赖
deps = [ ":windowStage_app_profile" ] deps = [ ":windowStage_app_profile" ]
# hap_profile: HAP的config.json,Stage模型对应module.json # hap_profile: HAP的config.json,Stage模型对应module.json
hap_profile = "src/main/module.json" hap_profile = "src/main/module.json"
} }
\ No newline at end of file
...@@ -21,6 +21,7 @@ ohos_js_hap_suite("ActsLifeCycleEtsTest") { ...@@ -21,6 +21,7 @@ ohos_js_hap_suite("ActsLifeCycleEtsTest") {
] ]
ets2abc = true ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "./signature/openharmony_sx.p7b"
# hap_name: HAP的名字,可选,默认为目标名 # hap_name: HAP的名字,可选,默认为目标名
hap_name = "ActsLifeCycleEtsTest" hap_name = "ActsLifeCycleEtsTest"
subsystem_name = "ability" subsystem_name = "ability"
...@@ -29,6 +30,7 @@ ohos_js_hap_suite("ActsLifeCycleEtsTest") { ...@@ -29,6 +30,7 @@ ohos_js_hap_suite("ActsLifeCycleEtsTest") {
ohos_app_scope("windowStage_app_profile") { ohos_app_scope("windowStage_app_profile") {
# app_profile: HAP的AppScope中的app.json,只在Stage模型下使用 # app_profile: HAP的AppScope中的app.json,只在Stage模型下使用
app_profile = "AppScope/app.json" app_profile = "AppScope/app.json"
# sources: 资源文件路径 # sources: 资源文件路径
sources = [ "AppScope/resources" ] sources = [ "AppScope/resources" ]
} }
...@@ -39,8 +41,10 @@ ohos_js_assets("windowStage_js_assets") { ...@@ -39,8 +41,10 @@ ohos_js_assets("windowStage_js_assets") {
ohos_resources("windowStage_resources") { ohos_resources("windowStage_resources") {
# sources: 资源文件路径 # sources: 资源文件路径
sources = [ "src/main/resources" ] sources = [ "src/main/resources" ]
# deps: 当前目标的依赖 # deps: 当前目标的依赖
deps = [ ":windowStage_app_profile" ] deps = [ ":windowStage_app_profile" ]
# hap_profile: HAP的config.json,Stage模型对应module.json # hap_profile: HAP的config.json,Stage模型对应module.json
hap_profile = "src/main/module.json" hap_profile = "src/main/module.json"
} }
\ No newline at end of file
...@@ -21,6 +21,7 @@ ohos_js_hap_suite("ActsUiAbilityEtsTest") { ...@@ -21,6 +21,7 @@ ohos_js_hap_suite("ActsUiAbilityEtsTest") {
] ]
ets2abc = true ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "./signature/openharmony_sx.p7b"
# hap_name: HAP的名字,可选,默认为目标名 # hap_name: HAP的名字,可选,默认为目标名
hap_name = "ActsUiAbilityEtsTest" hap_name = "ActsUiAbilityEtsTest"
subsystem_name = "ability" subsystem_name = "ability"
...@@ -29,6 +30,7 @@ ohos_js_hap_suite("ActsUiAbilityEtsTest") { ...@@ -29,6 +30,7 @@ ohos_js_hap_suite("ActsUiAbilityEtsTest") {
ohos_app_scope("windowStage_app_profile") { ohos_app_scope("windowStage_app_profile") {
# app_profile: HAP的AppScope中的app.json,只在Stage模型下使用 # app_profile: HAP的AppScope中的app.json,只在Stage模型下使用
app_profile = "AppScope/app.json" app_profile = "AppScope/app.json"
# sources: 资源文件路径 # sources: 资源文件路径
sources = [ "AppScope/resources" ] sources = [ "AppScope/resources" ]
} }
...@@ -39,8 +41,10 @@ ohos_js_assets("windowStage_js_assets") { ...@@ -39,8 +41,10 @@ ohos_js_assets("windowStage_js_assets") {
ohos_resources("windowStage_resources") { ohos_resources("windowStage_resources") {
# sources: 资源文件路径 # sources: 资源文件路径
sources = [ "src/main/resources" ] sources = [ "src/main/resources" ]
# deps: 当前目标的依赖 # deps: 当前目标的依赖
deps = [ ":windowStage_app_profile" ] deps = [ ":windowStage_app_profile" ]
# hap_profile: HAP的config.json,Stage模型对应module.json # hap_profile: HAP的config.json,Stage模型对应module.json
hap_profile = "src/main/module.json" hap_profile = "src/main/module.json"
} }
\ No newline at end of file
...@@ -28,6 +28,7 @@ export default class MainAbility1 extends Ability { ...@@ -28,6 +28,7 @@ export default class MainAbility1 extends Ability {
onCreate(want, launchParam) { onCreate(want, launchParam) {
console.log("[Demo] MainAbility1 onCreate") console.log("[Demo] MainAbility1 onCreate")
globalThis.launchParam1 = launchParam;
abilityName = want.abilityName abilityName = want.abilityName
globalThis.list1 = []; globalThis.list1 = [];
recordLife(globalThis.list1, abilityName, 'onCreate'); recordLife(globalThis.list1, abilityName, 'onCreate');
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
*/ */
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium";
import aConstant from '@ohos.app.ability.AbilityConstant'
function sleep(time) { function sleep(time) {
return new Promise((resolve) => setTimeout(resolve, time)); return new Promise((resolve) => setTimeout(resolve, time));
...@@ -481,5 +482,42 @@ export default function abilityTest() { ...@@ -481,5 +482,42 @@ export default function abilityTest() {
// await sleep(500); // await sleep(500);
// done(); // done();
// }) // })
/**
*@tc.number : UIAbilityConstantTest0100
*@tc.name : UIAbilityConstantTest0100
*@tc.desc : start mainability1, check ability constant.
*@tc.size : MediumTest
*@tc.type : Function
*@tc.level : Level 1
*/
it("UIAbilityConstantTest0100", 0, async (done) => {
console.log("------------UIAbilityConstantTest0100 START-------------");
TAG = "UIAbilityConstantTest0100";
var want = {
bundleName: "com.example.uiabilitylifecycle",
abilityName: "MainAbility1",
moduleName: moduleName,
};
globalThis.abilityContext
.startAbility(want)
.then((data) => {
console.info(TAG + " start successful. Data: " + data);
})
.catch((error) => {
console.error(TAG + " start failed. Cause: " + JSON.stringify(error));
});
await sleep(1000);
console.log('UIAbilityConstantTest0100:' + globalThis.launchParam1.lastExitReason)
expect(globalThis.launchParam1.launchReason == 1).assertTrue();
expect(globalThis.launchParam1.lastExitReason == 2).assertTrue();
expect(aConstant.LaunchReason.UNKNOWN == 0).assertTrue();
expect(aConstant.LastExitReason.UNKNOWN == 0).assertTrue();
done();
});
}); });
} }
...@@ -20,7 +20,7 @@ group("ability_crossplatform_runtime") { ...@@ -20,7 +20,7 @@ group("ability_crossplatform_runtime") {
"ActsLifeCycleEtsFeatureTest:ActsLifeCycleEtsFeatureTest", "ActsLifeCycleEtsFeatureTest:ActsLifeCycleEtsFeatureTest",
"ActsLifeCycleEtsTest:ActsLifeCycleEtsTest", "ActsLifeCycleEtsTest:ActsLifeCycleEtsTest",
"ActsUiAbilityEtsTest:ActsUiAbilityEtsTest", "ActsUiAbilityEtsTest:ActsUiAbilityEtsTest",
"commonTestAbilityApp:commonTestAbilityApp" "commonTestAbilityApp:commonTestAbilityApp",
] ]
} }
} }
...@@ -21,6 +21,7 @@ ohos_hap_assist_suite("commonTestAbilityApp") { ...@@ -21,6 +21,7 @@ ohos_hap_assist_suite("commonTestAbilityApp") {
] ]
ets2abc = true ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "./signature/openharmony_sx.p7b"
# hap_name: HAP的名字,可选,默认为目标名 # hap_name: HAP的名字,可选,默认为目标名
hap_name = "commonTestAbilityApp" hap_name = "commonTestAbilityApp"
subsystem_name = "ability" subsystem_name = "ability"
...@@ -29,6 +30,7 @@ ohos_hap_assist_suite("commonTestAbilityApp") { ...@@ -29,6 +30,7 @@ ohos_hap_assist_suite("commonTestAbilityApp") {
ohos_app_scope("windowStage_app_profile") { ohos_app_scope("windowStage_app_profile") {
# app_profile: HAP的AppScope中的app.json,只在Stage模型下使用 # app_profile: HAP的AppScope中的app.json,只在Stage模型下使用
app_profile = "AppScope/app.json" app_profile = "AppScope/app.json"
# sources: 资源文件路径 # sources: 资源文件路径
sources = [ "AppScope/resources" ] sources = [ "AppScope/resources" ]
} }
...@@ -39,8 +41,10 @@ ohos_js_assets("windowStage_js_assets") { ...@@ -39,8 +41,10 @@ ohos_js_assets("windowStage_js_assets") {
ohos_resources("windowStage_resources") { ohos_resources("windowStage_resources") {
# sources: 资源文件路径 # sources: 资源文件路径
sources = [ "src/main/resources" ] sources = [ "src/main/resources" ]
# deps: 当前目标的依赖 # deps: 当前目标的依赖
deps = [ ":windowStage_app_profile" ] deps = [ ":windowStage_app_profile" ]
# hap_profile: HAP的config.json,Stage模型对应module.json # hap_profile: HAP的config.json,Stage模型对应module.json
hap_profile = "src/main/module.json" hap_profile = "src/main/module.json"
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册