提交 90297e5e 编写于 作者: X xinking129

merge xts test

Signed-off-by: Nxinking129 <xinxin13@huawei.com>
上级 c61cc053
# Copyright (c) 2021 Huawei Device Co., Ltd. # Copyright (c) 2021-2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
...@@ -20,6 +20,8 @@ group("actsstagecontext") { ...@@ -20,6 +20,8 @@ group("actsstagecontext") {
"actsstagecontextassistone:ActsStageContextAssistOne", "actsstagecontextassistone:ActsStageContextAssistOne",
"actsstagecontextassisttwo:ActsStageContextAssistTwo", "actsstagecontextassisttwo:ActsStageContextAssistTwo",
"actsstagecontextpropertiestest:ActsStageContextPropertiesTest", "actsstagecontextpropertiestest:ActsStageContextPropertiesTest",
"ReportDrawnCompletedManualTestRely:ReportDrawnCompletedManualTestRely",
"ReportDrawnCompletedReply:ReportDrawnCompletedReply",
] ]
} }
} }
{
"app": {
"bundleName": "com.example.reportdrawncompletedmanualtest",
"vendor": "huawei",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 10,
"targetAPIVersion": 10,
"car": {
"apiCompatibleVersion": 10,
"singleUser": false
}
}
}
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ReportDrawnCompletedManualTestRely") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":reportdrawncompletedmanualtestrely_js_assets",
":reportdrawncompletedmanualtestrely_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ReportDrawnCompletedManualTestRely"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("reportdrawncompletedmanualtestrely_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("reportdrawncompletedmanualtestrely_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("reportdrawncompletedmanualtestrely_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":reportdrawncompletedmanualtestrely_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import hilog from '@ohos.hilog';
import Ability from '@ohos.app.ability.UIAbility';
import Window from '@ohos.window';
export default class EntryAbility extends Ability {
onCreate(want, launchParam) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
globalThis.context = this.context;
hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? '');
this.context.reportDrawnCompleted(() => {
console.info('The call to the reportDrawnCompleted interface succeeded');
});
}
onDestroy() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
}
onWindowStageCreate(windowStage: Window.WindowStage) {
// Main window is created, set main page for this ability
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
windowStage.loadContent('pages/Index', (err, data) => {
if (err.code) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR);
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
}
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? '');
});
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
}
onForeground() {
// Ability has brought to foreground
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
}
onBackground() {
// Ability has back to background
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
}
}
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'Hello World';
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index2 {
@State message: string = 'Hello World';
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"module": {
"name": "entry",
"type": "entry",
"description": "$string:module_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"abilities": [
{
"name": "EntryAbility",
"srcEntrance": "./ets/entryability/EntryAbility.ts",
"description": "$string:EntryAbility_desc",
"icon": "$media:icon",
"label": "$string:EntryAbility_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:start_window_background",
"launchType": "standard",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
]
}
}
\ No newline at end of file
{
"color": [
{
"name": "start_window_background",
"value": "#FFFFFF"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "module_desc",
"value": "module description"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "label"
},
{
"name": "UIAbility2_desc",
"value": "description"
},
{
"name": "UIAbility2_label",
"value": "label"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
{
"src": [
"pages/Index",
"pages/Index",
"pages/Index2",
"pages/Index2"
]
}
\ No newline at end of file
{
"string": [
{
"name": "module_desc",
"value": "module description"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "label"
},
{
"name": "UIAbility2_desc",
"value": "description"
},
{
"name": "UIAbility2_label",
"value": "label"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "module_desc",
"value": "模块描述"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "label"
},
{
"name": "UIAbility2_desc",
"value": "description"
},
{
"name": "UIAbility2_label",
"value": "label"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.stagecontextpropertiestest",
"vendor": "huawei",
"versionCode": 1000000,
"versionName": "1.0.0",
"debug": false,
"icon" : "$media:icon",
"label" : "$string:app_name",
"description" : "$string:description_application",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
\ No newline at end of file
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ReportDrawnCompletedReply") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":reportdrawncompletedreply_js_assets",
":reportdrawncompletedreply_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ReportDrawnCompletedReply"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("reportdrawncompletedreply_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("reportdrawncompletedreply_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("reportdrawncompletedreply_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":reportdrawncompletedreply_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.app.ability.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.info("ActsStageContextAssistOne StageAbility onCreate")
globalThis.abilityStageContextA = this.context;
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.app.ability.UIAbility'
import commonEvent from '@ohos.commonEvent'
export default class DrawnAbility extends Ability {
onCreate(want, launchParam) {
console.info('ActsStageContextAssistOne DrawnAbility onCreate')
this.context.reportDrawnCompleted(() => {
console.info('The call to the reportDrawnCompleted interface succeeded');
});
}
onDestroy() {
console.info('ActsStageContextAssistOne DrawnAbility onDestroy')
}
onWindowStageCreate(windowStage) {
console.info('ActsStageContextAssistOne DrawnAbility onWindowStageCreate');
windowStage.setUIContent(this.context, 'pages/index', null)
}
onWindowStageDestroy() {
console.info('ActsStageContextAssistOne DrawnAbility onWindowStageDestroy')
}
onForeground() {
console.info('ActsStageContextAssistOne DrawnAbility onForeground');
globalThis.abilityContextA = this.context;
commonEvent.publish("StartDrawnAbility_CommonEvent_ContextOne", () => {
console.log("Publish StartDrawnAbility_CommonEvent_ContextOne callback");
})
}
onBackground() {
console.info('ActsStageContextAssistOne DrawnAbility onBackground');
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('MainAbility index aboutToAppear')
console.info('start run testcase!!!')
}
@State message: string = 'MainAbility3 Hello'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(() => {
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"module": {
"name": "drawn",
"type": "feature",
"srcEntrance": "./ets/Application/MyAbilityStage.ts",
"description": "$string:entry_test_desc",
"mainElement": "DrawnAbility",
"deviceTypes": [
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"uiSyntax": "ets",
"abilities": [
{
"name": "DrawnAbility",
"srcEntrance": "./ets/MainAbility/DrawnAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"launchType": "specified",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_test_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "feature_MainAbility"
},
{
"name": "app_name",
"value": "ActsStageContextAssistOne"
},
{
"name": "description_application",
"value": "demo for test"
}
]
}
\ No newline at end of file
/* /*
* Copyright (c) 2022 Huawei Device Co., Ltd. * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
import { describe, it, expect, afterEach, beforeAll } from '@ohos/hypium' import { describe, it, expect, afterEach, beforeAll } from '@ohos/hypium'
import commonEvent from '@ohos.commonEvent' import commonEvent from '@ohos.commonEvent'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
let Subscriber; let Subscriber;
let TAG; let TAG;
...@@ -64,6 +65,15 @@ export default function stageContextPropertiesTest(abilityContext) { ...@@ -64,6 +65,15 @@ export default function stageContextPropertiesTest(abilityContext) {
}, 1500); }, 1500);
}) })
function beforeEachLoadmanagement() {
let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
abilityDelegator.executeShellCommand("hilog -r", async (err, data) => {});
abilityDelegator.executeShellCommand("hilog -Q pidoff", async (err, data) => {});
abilityDelegator.executeShellCommand("hilog -Q domainoff", async (err, data) => {});
abilityDelegator.executeShellCommand("hilog -b D", async (err, data) => {});
abilityDelegator.executeShellCommand("hilog -G 20M", async (err, data) => {});
}
/** /**
* @tc.number: SUB_AA_OpenHarmony_Context_0100 * @tc.number: SUB_AA_OpenHarmony_Context_0100
* @tc.name: Check that context paths of different Ability in the same hap are the same. * @tc.name: Check that context paths of different Ability in the same hap are the same.
...@@ -498,6 +508,105 @@ export default function stageContextPropertiesTest(abilityContext) { ...@@ -498,6 +508,105 @@ export default function stageContextPropertiesTest(abilityContext) {
} }
}); });
/**
* @tc.number: Acts_ReportDrawnCompleted_AsyncCallback_1400
* @tc.name: Load management
* @tc.desc: The uiability of this application use asyncCallback way call reportDrawnCompleted interface
* viewing console output information.
* @tc.level 1
*/
it('Acts_ReportDrawnCompleted_AsyncCallback_1400', 0, function (done) {
beforeEachLoadmanagement();
setTimeout(function () {
let want = {
"deviceId": "",
"bundleName": "com.example.stagecontextpropertiestest",
"abilityName": "DrawnAbility",
"moduleName": "drawn",
};
globalThis.abilityContext.startAbility(want, () => {});
let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
setTimeout(function () {
console.log('====>ReportDrawnCompleted_1400 expect start ');
let grepLog = "'\"name_\":\"DRAWN_COMPLETED\"'";
let cmd = "hilog -x | grep " + grepLog;
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.log('====>ReportDrawnCompleted_0100 executeShellCommand err : ' + JSON.stringify(err));
if (data.stdResult) {
console.log('====>ReportDrawnCompleted_1400 data.stdResult : ' + JSON.stringify(data.stdResult));
try {
expect(data.stdResult).assertContain("\"domain_\":\"AAFWK\"");
expect(data.stdResult).assertContain("\"name_\":\"DRAWN_COMPLETED\"");
expect(data.stdResult).assertContain("\"type_\":4");
expect(data.stdResult).assertContain("\"tz_\":\"+0800\"");
expect(data.stdResult).assertContain(
"\"BUNDLE_NAME\":\"com.example.stagecontextpropertiestest\"");
expect(data.stdResult).assertContain("\"MODULE_NAME\":\"drawn\"");
expect(data.stdResult).assertContain("\"ABILITY_NAME\":\"DrawnAbility\"");
} catch {
expect().assertFail();
done();
}
done();
} else {
expect().assertFail();
done();
}
});
}, 200);
}, 4000);
})
/*
* @tc.number: Acts_ReportDrawnCompleted_AsyncCallback_1500
* @tc.name: Load management
* @tc.desc: The uiAbility of this external application use asyncCallback way call reportDrawnCompleted interface
* viewing console output information.
* @tc.level 1
*/
it('Acts_ReportDrawnCompleted_AsyncCallback_1500', 0, function (done) {
beforeEachLoadmanagement();
setTimeout(function () {
let want = {
"deviceId": "",
"bundleName": "com.example.reportdrawncompletedmanualtest",
"abilityName": "EntryAbility"
};
globalThis.abilityContext.startAbility(want, () => {});
let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
setTimeout(function () {
console.log('====>ReportDrawnCompleted_1500 expect start ');
let grepLog = "'\"name_\":\"DRAWN_COMPLETED\"'";
let cmd = "hilog -x | grep " + grepLog;
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.log('====>ReportDrawnCompleted_1500 executeShellCommand err : ' + JSON.stringify(err));
if (data.stdResult) {
console.log('====>ReportDrawnCompleted_1500 data.stdResult : ' + JSON.stringify(data.stdResult));
try {
expect(data.stdResult).assertContain("\"domain_\":\"AAFWK\"");
expect(data.stdResult).assertContain("\"name_\":\"DRAWN_COMPLETED\"");
expect(data.stdResult).assertContain("\"type_\":4");
expect(data.stdResult).assertContain("\"tz_\":\"+0800\"");
expect(data.stdResult).assertContain(
"\"BUNDLE_NAME\":\"com.example.reportdrawncompletedmanualtest\"");
expect(data.stdResult).assertContain("\"MODULE_NAME\":\"entry\"");
expect(data.stdResult).assertContain("\"ABILITY_NAME\":\"EntryAbility\"");
} catch {
expect().assertFail();
done();
}
done();
} else {
expect().assertFail();
done();
}
});
}, 1000);
}, 4000);
})
function checkApplicationContextDir(applicationContext) { function checkApplicationContextDir(applicationContext) {
expect(applicationContext.cacheDir).assertEqual("/data/storage/el2/base/cache"); expect(applicationContext.cacheDir).assertEqual("/data/storage/el2/base/cache");
expect(applicationContext.tempDir).assertEqual("/data/storage/el2/base/temp"); expect(applicationContext.tempDir).assertEqual("/data/storage/el2/base/temp");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册