提交 521b71b1 编写于 作者: W wangyulie

修改ffrt的xts模型

Signed-off-by: Nwangyulie <wanglieyu@126.com>
上级 0a4c273f
{
"app": {
"bundleName": "com.actsffrt.napitest",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name"
},
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 10,
"singleUser": false
}
}
...@@ -13,29 +13,28 @@ ...@@ -13,29 +13,28 @@
import("//build/ohos.gni") import("//build/ohos.gni")
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("resourceschedule_ffrt_js_test") { ohos_js_hap_suite("resourceschedule_ffrt_js_test") {
hap_profile = "./src/main/module.json" hap_profile = "./entry/src/main/config.json"
deps = [ deps = [
":windowStage_js_assets", ":ace_third_ets_assets",
":windowStage_resources", ":ace_third_ets_resources",
":ace_third_ets_test_assets",
] ]
ets2abc = true ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsFfrtNativeTest" hap_name = "ActsFfrtNativeTest"
subsystem_name = "resourceschedule" subsystem_name = "resourceschedule"
part_name = "ffrt" part_name = "ffrt"
shared_libraries = [ "./src/main/cpp:ffrtndk" ] shared_libraries = [ "./entry/src/main/cpp:ffrtndk" ]
} }
ohos_app_scope("windowStage_app_profile") {
app_profile = "AppScope/app.json" ohos_js_assets("ace_third_ets_assets") {
sources = [ "AppScope/resources" ] source_dir = "./entry/src/main/ets/MainAbility"
} }
ohos_js_assets("windowStage_js_assets") { ohos_js_assets("ace_third_ets_test_assets") {
source_dir = "./src/main/ets" source_dir = "./entry/src/main/ets/TestAbility"
} }
ohos_resources("windowStage_resources") { ohos_resources("ace_third_ets_resources") {
sources = [ "./src/main/resources" ] sources = [ "./entry/src/main/resources" ]
deps = [ ":windowStage_app_profile" ] hap_profile = "./entry/src/main/config.json"
hap_profile = "./src/main/module.json"
} }
...@@ -2,11 +2,10 @@ ...@@ -2,11 +2,10 @@
"description": "Configuration for hjunit demo Tests", "description": "Configuration for hjunit demo Tests",
"driver": { "driver": {
"type": "OHJSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "180000", "test-timeout": "600000",
"bundle-name": "com.actsffrt.napitest", "bundle-name": "com.actsffrt.napitest",
"module-name": "entry_test", "package-name": "com.actsffrt.napitest",
"shell-timeout": "600000", "shell-timeout": "600000"
"testcase-timeout": 70000
}, },
"kits": [ "kits": [
{ {
...@@ -18,4 +17,3 @@ ...@@ -18,4 +17,3 @@
} }
] ]
} }
{
"app": {
"bundleName": "com.actsffrt.napitest",
"vendor": "open",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 9,
"releaseType": "Release",
"target": 9
}
},
"deviceConfig": {},
"module": {
"package": "com.actsffrt.napitest",
"name": ".MyApplication",
"mainAbility": "com.actsffrt.napitest.MainAbility",
"deviceType": [
"default",
"tablet"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:description_mainability",
"formsEnabled": false,
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
},
{
"orientation": "unspecified",
"visible": true,
"srcPath": "TestAbility",
"name": ".TestAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:TestAbility_desc",
"formsEnabled": false,
"label": "$string:TestAbility_label",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
...@@ -51,7 +51,6 @@ ohos_shared_library("ffrtndk") { ...@@ -51,7 +51,6 @@ ohos_shared_library("ffrtndk") {
deps = [ deps = [
"//foundation/resourceschedule/ffrt:ffrt_ndk", "//foundation/resourceschedule/ffrt:ffrt_ndk",
"//foundation/resourceschedule/ffrt/interfaces/kits:libffrt_ndk",
] ]
output_extension = "so" output_extension = "so"
......
/**
* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('Application onCreate')
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ 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 MyComponent {
aboutToAppear() {
}
build() {
Flex({
direction: FlexDirection.Column,
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Center
}) {
Text('BMS ETS TEST')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
/**
* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('Application onCreate')
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
/* /**
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 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
...@@ -12,14 +12,15 @@ ...@@ -12,14 +12,15 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import hilog from '@ohos.hilog'; import router from '@system.router';
@Entry @Entry
@Component @Component
struct Index { struct Index {
aboutToAppear() { aboutToAppear() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); console.info('TestAbility index aboutToAppear')
} }
@State message: string = 'Hello World' @State message: string = 'Hello World'
build() { build() {
Row() { Row() {
......
/* /**
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 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
...@@ -12,19 +12,33 @@ ...@@ -12,19 +12,33 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import hilog from '@ohos.hilog'; import TestRunner from '@ohos.application.testRunner'
import TestRunner from '@ohos.application.testRunner'; import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
var abilityDelegator = undefined var abilityDelegator = undefined
var abilityDelegatorArguments = undefined var abilityDelegatorArguments = undefined
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s itName',
'-s level', '-s testType', '-s size', '-s timeout',
'-s package'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key]
}
}
return targetParams.trim()
}
async function onAbilityCreateCallback() { async function onAbilityCreateCallback() {
hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); console.log('onAbilityCreateCallback');
} }
async function addAbilityMonitorCallback(err: any) { async function addAbilityMonitorCallback(err: any) {
hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); console.info('addAbilityMonitorCallback : ' + JSON.stringify(err))
} }
export default class OpenHarmonyTestRunner implements TestRunner { export default class OpenHarmonyTestRunner implements TestRunner {
...@@ -32,32 +46,32 @@ export default class OpenHarmonyTestRunner implements TestRunner { ...@@ -32,32 +46,32 @@ export default class OpenHarmonyTestRunner implements TestRunner {
} }
onPrepare() { onPrepare() {
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); console.info('OpenHarmonyTestRunner OnPrepare')
} }
async onRun() { onRun() {
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); console.log('OpenHarmonyTestRunner onRun run')
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility'
let lMonitor = { let lMonitor = {
abilityName: testAbilityName, abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback, onAbilityCreate: onAbilityCreateCallback,
}; };
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility'
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
var debug = abilityDelegatorArguments.parameters['-D'] cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
if (debug == 'true') console.info('cmd : '+cmd)
{
cmd += ' -D'
}
hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd);
abilityDelegator.executeShellCommand(cmd, abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => { (err: any, d: any) => {
hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); console.info('executeShellCommand : err : ' + JSON.stringify(err));
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); console.info('executeShellCommand : data : ' + d.stdResult);
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); console.info('executeShellCommand : data : ' + d.exitCode);
}) })
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext')
var context = abilityDelegator.getAppContext()
console.info('getAppContext : ' + JSON.stringify(context))
console.info('OpenHarmonyTestRunner onRun end')
} }
} };
\ No newline at end of file \ No newline at end of file
{ {
"string": [ "string": [
{ {
"name": "module_test_desc", "name": "entry_MainAbility",
"value": "test ability description" "value": "entry_MainAbility"
},
{
"name": "description_mainability",
"value": "ETS_Empty Ability"
}, },
{ {
"name": "TestAbility_desc", "name": "TestAbility_desc",
"value": "the test ability" "value": "description"
}, },
{ {
"name": "TestAbility_label", "name": "TestAbility_label",
"value": "test label" "value": "label"
} }
] ]
} }
\ No newline at end of file
/*
* Copyright (c) 2021 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 UIAbility from '@ohos.app.ability.UIAbility';
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
import hilog from '@ohos.hilog';
import { Hypium } from '@ohos/hypium';
import testsuite from '../test/List.test';
import window from '@ohos.window';
export default class TestAbility extends UIAbility {
onCreate(want, launchParam) {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate');
hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? '');
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!');
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
onDestroy() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy');
}
onWindowStageCreate(windowStage: window.WindowStage) {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate');
windowStage.loadContent('TestAbility/pages/Index', (err, data) => {
if (err.code) {
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
}
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s',
JSON.stringify(data) ?? '');
});
}
onWindowStageDestroy() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy');
}
onForeground() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground');
}
onBackground() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground');
}
}
\ No newline at end of file
{
"module": {
"name": "entry_test",
"type": "feature",
"description": "$string:module_test_desc",
"mainElement": "TestAbility",
"deviceTypes": [
"phone"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:test_pages",
"abilities": [
{
"name": "TestAbility",
"srcEntry": "./ets/TestAbility/TestAbility.ets",
"description": "$string:TestAbility_desc",
"icon": "$media:icon",
"label": "$string:TestAbility_label",
"exported": true,
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:start_window_background",
"skills": [
{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}
]
}
]
}
}
{
"color": [
{
"name": "start_window_background",
"value": "#FFFFFF"
}
]
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册